You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2018/03/20 03:01:00 UTC

[jira] [Comment Edited] (GROOVY-8511) @PackageScope(METHODS) fails under Parrot Parser due to synthetic public determination

    [ https://issues.apache.org/jira/browse/GROOVY-8511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16405710#comment-16405710 ] 

Daniel Sun edited comment on GROOVY-8511 at 3/20/18 3:00 AM:
-------------------------------------------------------------

[~emilles] your code runs well with groovy-3.0.0-alpha-1 and groovy-2.6.0-alpha-3:
{code:java}
import java.lang.reflect.*
import groovy.transform.PackageScope
import groovy.transform.PackageScopeTarget

@PackageScope(PackageScopeTarget.METHODS)
class Groovy8511 {
  private def isPrivate() {}
  def isPackagePrivate() {}
  public def isPublic() {}

  public static void main(args) {
      assert 'public' == Modifier.toString(getModifiers())
      assert 'public' == Modifier.toString(getDeclaredMethod('isPublic').modifiers)
      assert 'private' == Modifier.toString(getDeclaredMethod('isPrivate').modifiers)
      assert '' == Modifier.toString(getDeclaredMethod('isPackagePrivate').modifiers)
      println 'done'
  }
}
{code}
If you want to access the latest version of Parrot, you can reference the project: [https://github.com/danielsun1106/try-jitpack]


was (Author: daniel_sun):
[~emilles] your code runs well with groovy-3.0.0-alpha-1
{code:java}
import java.lang.reflect.*
import groovy.transform.PackageScope
import groovy.transform.PackageScopeTarget

@PackageScope(PackageScopeTarget.METHODS)
class Groovy8511 {
  private def isPrivate() {}
  def isPackagePrivate() {}
  public def isPublic() {}

  public static void main(args) {
      assert 'public' == Modifier.toString(getModifiers())
      assert 'public' == Modifier.toString(getDeclaredMethod('isPublic').modifiers)
      assert 'private' == Modifier.toString(getDeclaredMethod('isPrivate').modifiers)
      assert '' == Modifier.toString(getDeclaredMethod('isPackagePrivate').modifiers)
      println 'done'
  }
}
{code}

If you want to access the latest version of Parrot, you can reference the project:  https://github.com/danielsun1106/try-jitpack


> @PackageScope(METHODS) fails under Parrot Parser due to synthetic public determination
> --------------------------------------------------------------------------------------
>
>                 Key: GROOVY-8511
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8511
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.6.0-alpha-3
>            Reporter: Eric Milles
>            Assignee: Daniel Sun
>            Priority: Major
>
> The new Parrot Parser does not set the synthetic public flag quite the same as before for methods.  This affects {{@PackageScope(PackageScopeTarget.METHODS)}} specifically because it checks that a method is synthetic public before altering the method's modifiers.
> You can compare how this flag is set for methods in {{AntlrParserPlugin.methodDef}} and {{AstBuilder.visitMethodDeclaration(MethodDeclarationContext)}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)