NullPointerException when declare @type is spelt with capital letter patch submitted by Andrew Hufftags/PRE_ANDY
@@ -80,7 +80,9 @@ public class DeclareAnnotationDeclaration extends DeclareDeclaration { | |||
public void postParse(TypeDeclaration typeDec) { | |||
super.postParse(typeDec); | |||
((DeclareAnnotation)declareDecl).setAnnotationMethod(new String(selector)); | |||
if (declareDecl != null){ | |||
((DeclareAnnotation)declareDecl).setAnnotationMethod(new String(selector)); | |||
} | |||
} | |||
} |
@@ -0,0 +1,7 @@ | |||
// "declare @Type (should be @type)" | |||
@interface myInterface {} | |||
aspect A{ | |||
declare @Type: A : @myInterface; | |||
} |
@@ -322,4 +322,9 @@ public class DeclareAnnotationTests extends XMLBasedAjcTestCase { | |||
assertTrue("Should have a relationship but does not ",l.size()>0); | |||
} | |||
} | |||
public void testDeclareTypeMisspelled() { | |||
runTest("declare @Type (should be @type)"); | |||
} | |||
} |
@@ -125,11 +125,6 @@ | |||
<ajc-test dir="bugs150" title="bad asm for enums" vm="1.5"> | |||
<compile files="Rainbow.java" options="-emacssym,-1.5"/> | |||
</ajc-test> | |||
<ajc-test dir="bugs150" pr="83645" title="pertypewithin({interface}) illegal field modifier"> | |||
<compile files="PR83645.java"/> | |||
<run class="PR83645"/> | |||
</ajc-test> | |||
<ajc-test dir="../docs/dist/doc/examples/introduction" title="introduction sample" vm="1.5"> | |||
<compile files="CloneablePoint.java,ComparablePoint.java,HashablePoint.java,Point.java" options="-1.5"/> | |||
@@ -545,6 +540,12 @@ | |||
</run> | |||
</ajc-test> | |||
<ajc-test dir="java5/annotations/declare" pr="91858" title="declare @Type (should be @type)"> | |||
<compile files="DeathByPoorSpelling.aj" options="-1.5"> | |||
<message kind="error" line="6" text="Syntax error on token ":", "one of type, method, field, constructor" expected"/> | |||
</compile> | |||
</ajc-test> | |||
<!-- ======================================================================================= --> | |||
<!-- Autoboxing tests --> | |||
<!-- ======================================================================================= --> |
@@ -139,8 +139,7 @@ public class PatternParser { | |||
} else if (kind.equals("constructor")) { | |||
ret = parseDeclareAtMethod(false); | |||
} else { | |||
throw new ParserException("expected one of type, method, field, constructor", | |||
tokenSource.peek(-1)); | |||
throw new ParserException("one of type, method, field, constructor",tokenSource.peek(-1)); | |||
} | |||
eat(";"); | |||
int endPos = tokenSource.peek(-1).getEnd(); |