You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was unable to re-produce it with pure groovy, but with simple grails it is working:
create simple empty grails app (using sdkman)
inject GrailsApplication
access any field in config
syntax highlight will be broken in the current method after that till the end of this method
Sample:
packagegrails.sampleimportgrails.core.GrailsApplicationclassSampleService {
GrailsApplication grailsApplication
defsome() {
if (true) {
String var ='qwe'println'ok'
}
grailsApplication.config
if (true) {
String var ='qwe'println'still ok'
}
grailsApplication.config.some
if (false) {
String var ='qwe'println'fail'
}
}
}
Stack trace from error log:
eclipse.buildId=4.11.0.I20190307-0500
java.version=1.8.0_131
java.vendor=Oracle Corporation
BootLoaderconstants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Frameworkarguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product
This is a continuation of log file /ptmp/workspace/.metadata/.bak_0.log
CreatedTime: 2019-10-2118:10:00.441
org.eclipse.jdt.groovy.core
ErrorTueOct2213:05:45EDT 2019
Groovy-EclipseTypeInferencing: Error visiting method some in classSampleService
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.lookupExpressionType(TypeInferencingVisitorWithRequestor.java:2521)
at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.handleSimpleExpression(TypeInferencingVisitorWithRequestor.java:1869)
at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.handleSimpleExpression(TypeInferencingVisitorWithRequestor.java:1874)
at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitConstantExpression(TypeInferencingVisitorWithRequestor.java:967)
at org.codehaus.groovy.ast.expr.ConstantExpression.visit(ConstantExpression.java:84)
at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitPropertyExpression(TypeInferencingVisitorWithRequestor.java:1538)
at org.codehaus.groovy.ast.expr.PropertyExpression.visit(PropertyExpression.java:57)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:120)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:266)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:86)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:236)
at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitBlockStatement(TypeInferencingVisitorWithRequestor.java:823)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:145)
at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitConstructorOrMethod(TypeInferencingVisitorWithRequestor.java:1068)
at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitMethodInternal(TypeInferencingVisitorWithRequestor.java:624)
at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitJDT(TypeInferencingVisitorWithRequestor.java:448)
at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitJDT(TypeInferencingVisitorWithRequestor.java:339)
at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitCompilationUnit(TypeInferencingVisitorWithRequestor.java:246)
at org.codehaus.groovy.eclipse.codebrowsing.requestor.CodeSelectHelper.select(CodeSelectHelper.java:84)
at org.codehaus.jdt.groovy.model.GroovyCompilationUnit.codeSelect(GroovyCompilationUnit.java:506)
at org.codehaus.jdt.groovy.model.GroovyCompilationUnit.codeSelect(GroovyCompilationUnit.java:499)
at org.codehaus.jdt.groovy.model.GroovyCompilationUnit.codeSelect(GroovyCompilationUnit.java:493)
at org.eclipse.recommenders.internal.rcp.JavaElementSelections.resolveJavaElementFromTypeRootInEditor(JavaElementSelections.java:138)
at org.eclipse.recommenders.internal.rcp.JavaElementSelections.resolveJavaElementFromEditor(JavaElementSelections.java:119)
at org.eclipse.recommenders.internal.rcp.JavaElementSelections.resolveJavaElementFromEditor(JavaElementSelections.java:102)
at org.eclipse.recommenders.internal.rcp.JavaElementSelectionService.handleSelectionInEditor(JavaElementSelectionService.java:108)
at org.eclipse.recommenders.internal.rcp.JavaElementSelectionService.access$1(JavaElementSelectionService.java:105)
at org.eclipse.recommenders.internal.rcp.JavaElementSelectionService$1.run(JavaElementSelectionService.java:82)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
I am using Eclipse Version: 2019-03 (4.11.0)
Eclipse Groovy Development Tools: 3.6.0.v201910182213-e1903
The text was updated successfully, but these errors were encountered:
Thanks for reporting. Inference engine is trying to determine expression type using generics on java.util.Map's V put(K, V) method. Not sure why the method was not available, but I'll make sure the code is safer.
if (result.confidence == TypeConfidence.UNKNOWN && result.declaringType != null &&
GeneralUtils.isOrImplements(result.declaringType, VariableScope.MAP_CLASS_NODE)) {
ClassNodeinferredType = VariableScope.OBJECT_CLASS_NODE;
if (nodeinstanceofConstantExpression && node.getType().equals(VariableScope.STRING_CLASS_NODE)) {
List<MethodNode> putMethods = result.declaringType.getMethods("put"); // returns the value typeGenericsMappermapper = GenericsMapper.gatherGenerics(result.declaringType, result.declaringType.redirect());
inferredType = VariableScope.resolveTypeParameterization(mapper, VariableScope.clone(putMethods.get(0).getReturnType()));
I was unable to re-produce it with pure groovy, but with simple grails it is working:
Sample:
Stack trace from error log:
I am using Eclipse Version: 2019-03 (4.11.0)
Eclipse Groovy Development Tools: 3.6.0.v201910182213-e1903
The text was updated successfully, but these errors were encountered: