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

[jira] [Commented] (GROOVY-8817) MacroMethodsCache.get throws no such method error when runs under Eclipse

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

ASF GitHub Bot commented on GROOVY-8817:
----------------------------------------

GitHub user dpolivaev opened a pull request:

    https://github.com/apache/groovy/pull/804

    Fix variable type

    https://issues.apache.org/jira/browse/GROOVY-8817

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dpolivaev/groovy GROOVY_2_5_X

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/804.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #804
    
----
commit 7dd44f042b255d3a03b247e0cf6edcbfc4855d3e
Author: Dimitry Polivaev <dp...@...>
Date:   2018-10-03T07:25:58Z

    Fix variable type
    
    https://issues.apache.org/jira/browse/GROOVY-8817

----


> MacroMethodsCache.get throws no such method error when runs under Eclipse
> -------------------------------------------------------------------------
>
>                 Key: GROOVY-8817
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8817
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.5.0, 2.5.1, 2.5.2
>            Reporter: Dimitry Polivaev
>            Priority: Major
>
>  
> Debugging my application  embedding Groovy 2.5.2 under Eclipse I get following exception trace:
>  
>  
> {code:java}
> Caused by: java.lang.NoSuchMethodError: org.codehaus.groovy.runtime.memoize.EvictableCache.getAndPut(Ljava/lang/Object;Lorg/codehaus/groovy/runtime/memoize/MemoizeCache$ValueProvider;)Ljava/lang/Object;
>     at org.codehaus.groovy.macro.transform.MacroMethodsCache.get(MacroMethodsCache.java:50)
>     at org.codehaus.groovy.macro.transform.MacroCallTransformingVisitor.findMacroMethods(MacroCallTransformingVisitor.java:118)
>     at org.codehaus.groovy.macro.transform.MacroCallTransformingVisitor.visitMethodCallExpression(MacroCallTransformingVisitor.java:89)
>     at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66)
>     at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:71)
>     at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:196)
>     at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
>     at org.codehaus.groovy.ast.MethodCallTransformation.visit(MethodCallTransformation.java:55)
>     at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:321)
>     at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)
>     at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
>     at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
>     at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
>     at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
>     at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
> {code}
>  
>  
> When I check the sources I see following:
>  
> {code:java}
> import org.codehaus.groovy.runtime.memoize.EvictableCache;
> ...
> private static final EvictableCache<ClassLoader, Map<String, List<MethodNode>>> CACHE = new ConcurrentCommonCache<ClassLoader, Map<String, List<MethodNode>>>(new WeakHashMap<ClassLoader, Map<String, List<MethodNode>>>());
>     public static Map<String, List<MethodNode>> get(final ClassLoader classLoader) {
>         return CACHE.getAndPut(classLoader, new EvictableCache.ValueProvider<ClassLoader, Map<String, List<MethodNode>>>() {
>             @Override
>             public Map<String, List<MethodNode>> provide(ClassLoader key) {
>                 return Collections.unmodifiableMap(getMacroMethodsFromClassLoader(key));
>             }
>         });
> {code}
> EvictableCache does not contain method `getAndPut`, although ConcurrentCommonCache does.
> Problem could be related to https://issues.apache.org/jira/browse/GROOVY-8525
> I have no idea why the issue does not come if I run the app compiled by gradle
> Gradle compiles against groovy 2.4.8 and runs with Gradle 2.5.2 (and 2.5.3-SNAPSHOT)
>  



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