You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Stephan Classen (JIRA)" <ji...@apache.org> on 2019/05/20 18:10:00 UTC
[jira] [Closed] (GROOVY-9125) Static block is not annotateable with
@Generated
[ https://issues.apache.org/jira/browse/GROOVY-9125?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stephan Classen closed GROOVY-9125.
-----------------------------------
Resolution: Not A Problem
The current behaviour of both jacoco and groovy are correct.
The static block must not be marked as generated since it can contain user code
{code:java}
@Sortable
public class SomeClass {
String first
static {
// some user code
}
{code}
> Static block is not annotateable with @Generated
> ------------------------------------------------
>
> Key: GROOVY-9125
> URL: https://issues.apache.org/jira/browse/GROOVY-9125
> Project: Groovy
> Issue Type: Bug
> Reporter: Stephan Classen
> Priority: Major
> Attachments: jacoco_report.png
>
>
> The {{groovy.transform.Sortable}} annotation generates a static block
> {code:java}
> static {
> Object var0 = $getCallSiteArray()[5].callConstructor(GroovySortableClassTarget.FirstComparator.class);
> this$FirstComparator = (Comparator)ScriptBytecodeAdapter.castToType(var0, Comparator.class);
> Object var1 = $getCallSiteArray()[6].callConstructor(GroovySortableClassTarget.LastComparator.class);
> this$LastComparator = (Comparator)ScriptBytecodeAdapter.castToType(var1, Comparator.class);
> Object var2 = $getCallSiteArray()[7].callConstructor(GroovySortableClassTarget.BornComparator.class);
> this$BornComparator = (Comparator)ScriptBytecodeAdapter.castToType(var2, Comparator.class);
> }
> {code}
> This static block shows up in the jacoco report (see attached screenshot).
> It would be nice if this block would be marked as generated.
> Maybe this needs coordination with jacoco in case it is not possible to use the {{@Generated}} annotation on static blocks.
> See also GROOVY-9050
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)