diff options
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java | 6 | ||||
-rw-r--r-- | tests/ajcTests.xml | 7 | ||||
-rw-r--r-- | tests/bugs/Pr51322.java | 6 |
3 files changed, 19 insertions, 0 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java index d5bf73da6..ef69dc022 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java @@ -28,6 +28,7 @@ import org.eclipse.jdt.internal.compiler.flow.FlowInfo; import org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext; import org.eclipse.jdt.internal.compiler.lookup.*; import org.eclipse.jdt.internal.compiler.parser.Parser; +import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; /** * An inter-type method declaration. @@ -101,6 +102,11 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration { if (ignoreFurtherInvestigation) return null; binding = classScope.referenceContext.binding.resolveTypesFor(binding); + if (binding == null) { + // if binding is null, we failed to find a type used in the method params, this error + // has already been reported. + throw new AbortCompilation(); + } ResolvedMember sig = new ResolvedMember(Member.METHOD, EclipseFactory.fromBinding(onTypeBinding), declaredModifiers, EclipseFactory.fromBinding(binding.returnType), new String(declaredSelector), EclipseFactory.fromBindings(binding.parameters), diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index d14bd19bd..06585a262 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -7303,4 +7303,11 @@ <message kind="error" line="6"/> </compile> </ajc-test> + + <ajc-test dir="bugs" pr="51322" + title="Introduce Unknown Type to class causes Null pointer exception" > + <compile files="Pr51322.java"> + <message kind="error" line="5"/> + </compile> + </ajc-test> </suite> diff --git a/tests/bugs/Pr51322.java b/tests/bugs/Pr51322.java new file mode 100644 index 000000000..9a7268e96 --- /dev/null +++ b/tests/bugs/Pr51322.java @@ -0,0 +1,6 @@ +class A {} +public abstract aspect Pr51322 +{ + public void A.aMethod(Object x) {} + public void A.someMethod(WCharType a) { } +}
\ No newline at end of file |