--- /dev/null
+public aspect SyntaxError {
+
+ after(Object x) : execution((@Alien *) Passenger+.new(..)) && this(x) {
+ System.out.println("after alien...");
+ }
+
+}
+
+@interface Alien{}
+
+class Passenger {
+
+ @Alien Passenger() {}
+
+}
+
+class SubPassenger extends Passenger {
+
+ @Alien SubPassenger() { super(); }
+
+}
\ No newline at end of file
<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="java5/annotations" title="invalid cons syntax" vm="1.5">
+ <compile files="SyntaxError.aj" options="-1.5">
+ <message kind="error" line="3" text="Syntax error on token "new", "method name (not constructor)" expected"/>
+ </compile>
+ </ajc-test>
+
<!-- Annotation binding tests -->
<ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 1">
name = NamePattern.ANY;
} else {
kind = Member.METHOD;
+ IToken nameToken = tokenSource.peek();
declaringType = parseTypePattern();
if (maybeEat(".")) {
+ nameToken = tokenSource.peek();
name = parseNamePattern();
} else {
name = tryToExtractName(declaringType);
- if (name == null) {
- throw new ParserException("name pattern", tokenSource.peek());
- }
- String simpleName = name.maybeGetSimpleName();
- //XXX should add check for any Java keywords
- if (simpleName != null && simpleName.equals("new")) {
- throw new ParserException("constructor patterns have no return type",
- tokenSource.peek());
- }
if (declaringType.toString().equals("")) {
declaringType = TypePattern.ANY;
}
- }
+ }
+ if (name == null) {
+ throw new ParserException("name pattern", tokenSource.peek());
+ }
+ String simpleName = name.maybeGetSimpleName();
+ //XXX should add check for any Java keywords
+ if (simpleName != null && simpleName.equals("new")) {
+ throw new ParserException("method name (not constructor)",
+ nameToken);
+ }
}
TypePatternList parameterTypes = parseArgumentsPattern();