Browse Source

fix for Bugzilla Bug 51322

 	Introduce Unknown Type to class causes Null pointer exception
tags/Root_ajdt_support
acolyer 20 years ago
parent
commit
5c67166488

+ 6
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java View File

@@ -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),

+ 7
- 0
tests/ajcTests.xml View File

@@ -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>

+ 6
- 0
tests/bugs/Pr51322.java View File

@@ -0,0 +1,6 @@
class A {}
public abstract aspect Pr51322
{
public void A.aMethod(Object x) {}
public void A.someMethod(WCharType a) { }
}

Loading…
Cancel
Save