Skip to content

Commit

Permalink
JDTClassNode.getTypeClass() throw exception instead of error for catches
Browse files Browse the repository at this point in the history
BUG! exception in phase 'class generation' in source unit
'.../Source.groovy' JDTClassNode.getTypeClass() cannot locate class for
foo.bar.Baz using transform loader
groovy.lang.GroovyClassLoader@10561854
	at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.getTypeClass(JDTClassNode.java:647)
	at org.apache.groovy.ast.tools.ExpressionUtils.transformInlineConstants(ExpressionUtils.java:252)
	at org.codehaus.groovy.classgen.Verifier.addFieldInitialization(Verifier.java:1176)
	at org.codehaus.groovy.classgen.Verifier.addInitialization(Verifier.java:1056)
	at org.codehaus.groovy.classgen.Verifier.addInitialization(Verifier.java:1007)
	at org.codehaus.groovy.classgen.Verifier.visitClass(Verifier.java:252)
	at org.codehaus.groovy.control.CompilationUnit$6.call(CompilationUnit.java:830)
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1154)
	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:658)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:636)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:613)
	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.processToPhase(GroovyCompilationUnitDeclaration.java:214)
	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.generateCode(GroovyCompilationUnitDeclaration.java:322)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:915)
	at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:145)
	at java.lang.Thread.run(Thread.java:748)
  • Loading branch information
eric-milles committed Dec 28, 2018
1 parent bfd9996 commit d6fa240
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
import java.util.Set;
import java.util.stream.Stream;

import org.codehaus.groovy.GroovyBugError;
import groovy.lang.MissingClassException;

import org.codehaus.groovy.ast.AnnotationNode;
import org.codehaus.groovy.ast.ClassHelper;
import org.codehaus.groovy.ast.ClassNode;
Expand Down Expand Up @@ -129,7 +130,7 @@ public JDTClassNode(ReferenceBinding jdtReferenceBinding, JDTResolver resolver)
this.jdtBinding = jdtReferenceBinding;
this.resolver = resolver;

// population of the methods/ctors/fields/etc is not done until required
// population of fields, methods, etc. is deferred until required
this.lazyInitDone = false;

// a primary node will result in a class file
Expand Down Expand Up @@ -644,7 +645,7 @@ public Class getTypeClass() {
unfindable = true;
}
}
throw new GroovyBugError("JDTClassNode.getTypeClass() cannot locate class for " + getName() + " using transform loader " + transformLoader);
throw new MissingClassException(this, "-- JDTClassNode.getTypeClass() cannot locate it using transform loader " + transformLoader);
}

public boolean isAnonymous() {
Expand Down

0 comments on commit d6fa240

Please sign in to comment.