return other;
}
- Pos.new(MagicKey key) {
+ Pos.new(MagicKey key) {
+ this();
other = id;
id = getOther();
}
aspect Aspect {
static int count = 0;
//introduction subtypes(Class) {
- Class.new(int i) {count++;}
+ Class.new(int i) {this(); count++;}
SubClass.new(int i) {super(2); count++;}
//}
}
C1.new() {
c1Count++;
- }
- C1.new(int x) {
- c1IntCount++;
- }
- }
+ }
+ C1.new(int x) {
+ c1IntCount++;
+ }
+}
aspect Verify {
// System.out.println(thisJoinPoint.className +"."+
// thisJoinPoint.methodName);
}
- Foo.new(int n) { ranIntroducedConstructor = true; }
+ Foo.new(int n) { this(); ranIntroducedConstructor = true; }
// make sure advice doesn't go on the toString() method
// this would result in an infinite recursion
// initialization(HW.new(String)) will not match !
aspect A {
- HW.new(String s) {}
+ HW.new(String s) { this(); }
declare warning : initialization(HW.new(String,A)) : "Funky ctor found!";
}
aspect B {
- public A.new(String s) { }
+ public A.new(String s) {this(); }
public void A.foo() { int i = 1; }
declare warning: withincode(void main(..)): "X"; // Would NPE without the fix for PR67774
aspect X {
- public PR82570_1.new(String p) {}
+ public PR82570_1.new(String p) { this(); }
public int PR82570_1.itdField;
--- /dev/null
+import org.aspectj.lang.annotation.*;
+
+public aspect Pr62606 {
+
+ // xlint
+ public Target.new() {}
+
+ // no xlint
+ public Target.new(String s) {
+ this(1);
+ }
+
+ // no xlint
+ @SuppressAjWarnings
+ public Target.new(double d) {}
+
+ // no xlint
+ @SuppressAjWarnings({"noExplicitConstructorCall"})
+ public Target.new(float f) {}
+
+ // no xlint
+ @SuppressAjWarnings({"adviceDidNotMatch","noExplicitConstructorCall"})
+ public Target.new(short s) {}
+}
+
+class Target {
+
+ int x = 5;
+ int y;
+
+ public Target(int z) {
+ this.y = z;
+ }
+
+}
\ No newline at end of file
}
aspect A {
public pr111481.new(Object... names) {
+ this();
System.out.println(names[0]);
}
aspect D {
public C.new(String s) {
+ this();
}
public void C.anotherMethod(String s) {
}
aspect A {
- HW.new(String s) {}
+ HW.new(String s) {this();}
declare warning : initialization(HW.new(String,A)) : "should not match";
declare warning : initialization(HW.new(String)) : "should match";
}
return new C(2).m();
}
- public C.new(String s) { }
+ public C.new(String s) { this(); }
private C.new(int i) {
- Tester.note("new A.C");
+ this(); Tester.note("new A.C");
}
}
}
private C.new(int i) {
- Tester.note("new B.C");
+ this(); Tester.note("new B.C");
}
}
}
int Foo.foo(int n) { return n; }
- Foo.new(int w) {}
+ Foo.new(int w) {this();}
int around(int n):
within(AdviceOnIntroduced) &&
}
int Foo.foo(int n) { return n; }
- Foo.new(int w) {}
+ Foo.new(int w) { this(); }
int around(int n):
within(AdviceOnIntroduced) &&
}
int Foo.foo(int n) { return n; }
- Foo.new(int w) {}
+ Foo.new(int w) {this();}
int around(int n):
within(AdviceOnIntroduced) &&
@MethodAnnotation private int ITDMe.getGoo() { return goo; }
- @ConstructorAnnotation public ITDMe.new(int x) { goo = x; }
+ @ConstructorAnnotation public ITDMe.new(int x) { this(); goo = x; }
}
public aspect BindingWithAnnotatedItds3 {
- @Fruit("pear") A.new(String s) { }
+ @Fruit("pear") A.new(String s) { this(); }
- private @Fruit("orange") A.new(int i) { }
+ private @Fruit("orange") A.new(int i) { this(); }
- public @Fruit("tomato") A.new(boolean b) { }
+ public @Fruit("tomato") A.new(boolean b) { this(); }
public static void main(String[]argv) {
A instance1 = new A("a");
public aspect BindingWithDeclaredAnnotationItds4 {
- A.new(String s) { }
+ A.new(String s) { this(); }
- private A.new(int i) { }
+ private A.new(int i) { this(); }
- public A.new(boolean b) { }
+ public A.new(boolean b) { this(); }
public static void main(String[]argv) {
A instance1 = new A("a");
// annotated ITD constructors
@SomeAnnotation(s="hello",clazz=AnnotationsAndITDs.class)
- public ITDMe.new(String s) {}
+ public ITDMe.new(String s) { this(); }
@SomeAnnotation(s="goodbye",clazz=String.class)
- private ITDMe.new(int x) {}
+ private ITDMe.new(int x) { this(); }
// annotated ITD methods
declare @constructor : ITDMe2.new(..) : @SomeAnnotation(s="@cons",clazz=String.class);
- public ITDMe2.new(String s) {}
- private ITDMe2.new(int x) {}
+ public ITDMe2.new(String s) { this(); }
+ private ITDMe2.new(int x) { this(); }
// annotated ITD methods
int A.c(String s) { return 1; }
- public A.new(String s) {}
+ public A.new(String s) { this(); }
- private A.new(String s,String s2) {}
+ private A.new(String s,String s2) { this(); }
- A.new(String s, Object o) {}
+ A.new(String s, Object o) { this(); }
public int A.f ;
aspect X {
- <T> Base.new(List<T> elements) { }
+ <T> Base.new(List<T> elements) { this(); }
}
aspect X {
// wildcards, argh!
- <T> Base.new(List<T> one,List<? extends T> two) { }
+ <T> Base.new(List<T> one,List<? extends T> two) { this(); }
}
aspect X {
<T> Sorter.new(List<T> elements,Comparator<? super T> comparator) {
+ this();
Collections.sort(elements,comparator);
l = elements;
}
public class Parse3 { }
aspect X {
- <T> Parse3.new(T cupOf) {}
+ <T> Parse3.new(T cupOf) {this();}
}
aspect X {
public Base<Z>.new(Z aNumber) {
- ;
+ this() ;
}
public List<Z> Base<Z>.f2;
}
class Base<N extends Number> {
- //public Base(List<N> sn) {}
+ public Base() {}
<Y extends Number> Base(Set<N> sn, List<Y> ys) {}
}
aspect X {
- public Base<Z>.new(List<Z> lz) {}; // OK, Z becomes N in parameter
+ public Base<Z>.new(List<Z> lz) { this(); } // OK, Z becomes N in parameter
}
}
aspect X {
- public Base<Z>.new(List<List<Z>> llz) {}; // ok - nested but OK
+ public Base<Z>.new(List<List<Z>> llz) { this(); }; // ok - nested but OK
}
}
aspect X {
- public Base<A,B>.new(Map<A,B> mabs) {}; // ok multiple
+ public Base<A,B>.new(Map<A,B> mabs) { this(); }; // ok multiple
}
}
aspect X {
- public Base<Z>.new(List<String> ls) {}; // ok - specified type variable but didnt use it (could put a lint warning on this case?)
+ public Base<Z>.new(List<String> ls) { this(); }; // ok - specified type variable but didnt use it (could put a lint warning on this case?)
}
}
aspect X {
- public Base<A,B,C>.new(Map<C,A> lc,Map<B,A> lb) {} // ok multiple in funny orders
+ public Base<A,B,C>.new(Map<C,A> lc,Map<B,A> lb) { this(); } // ok multiple in funny orders
}
public aspect CtorG {
// visibility options...
- public Base<Z>.new(List<Z> lz,int i) {}
- private Base<Z>.new(List<Z> lz,String s) {}
- Base<Z>.new(List<Z> lz,boolean b) {}
+ public Base<Z>.new(List<Z> lz,int i) { this();}
+ private Base<Z>.new(List<Z> lz,String s) { this();}
+ Base<Z>.new(List<Z> lz,boolean b) {this();}
public static void main(String []argv) {
List<Integer> intList = new ArrayList<Integer>();
class Base<N> { }
aspect X {
- public Base<Z>.new(List<Z> lz) {} // OK, Z becomes N in first case, S in the second ;)
+ public Base<Z>.new(List<Z> lz) {this();} // OK, Z becomes N in first case, S in the second ;)
}
class Base<N extends Number> { }
aspect X {
- public Base<Z>.new(List<Z> lz) {}
+ public Base<Z>.new(List<Z> lz) {this();}
}
<R extends Number> void Base.packageMethod2(List<R> lr1,List<R> lr2) {}
// ctor
- <P extends Number> Base.new(List<P> lr) {}
- <P extends Number> Base.new(List<P> lr1,List<P> lr2) {}
- <P,Q extends Number> Base.new(List<P> lp,Map<Q,P> m1) {}
+ <P extends Number> Base.new(List<P> lr) { this(); }
+ <P extends Number> Base.new(List<P> lr1,List<P> lr2) { this(); }
+ <P,Q extends Number> Base.new(List<P> lp,Map<Q,P> m1) { this(); }
}
private <R extends Number> void Base.privateMethod2(List<R> lr1,List<R> lr2) {}
// ctor
- private <P extends Number> Base.new(List<P> lr) {}
- private <P extends Number> Base.new(List<P> lr1,List<P> lr2) {}
- private <P,Q extends Number> Base.new(List<P> lp,Map<Q,P> m1) {}
+ private <P extends Number> Base.new(List<P> lr) { this(); }
+ private <P extends Number> Base.new(List<P> lr1,List<P> lr2) { this(); }
+ private <P,Q extends Number> Base.new(List<P> lp,Map<Q,P> m1) { this(); }
}
public <R extends Number> void Base.publicMethod2(List<R> lr1,List<R> lr2) {}
// ctor
- public <P extends Number> Base.new(List<P> lr) {}
- public <P extends Number> Base.new(List<P> lr1,List<P> lr2) {}
- public <P,Q extends Number> Base.new(List<P> lp,Map<Q,P> m1) {}
+ public <P extends Number> Base.new(List<P> lr) { this(); }
+ public <P extends Number> Base.new(List<P> lr1,List<P> lr2) { this(); }
+ public <P,Q extends Number> Base.new(List<P> lp,Map<Q,P> m1) { this(); }
// what use is this next one??
// public <R extends Number> R Base.publicMethod3() { return null;}
public <R extends Number> void Base.publicMethod2(List<R> lr1,List<R> lr2) {}
// ctor
- public <P extends Number> Base.new(List<P> lr) {}
- public <P extends Number> Base.new(List<P> lr1,List<P> lr2) {}
- public <P,Q extends Number> Base.new(List<P> lp,Map<Q,P> m1) {}
+ public <P extends Number> Base.new(List<P> lr) { this(); }
+ public <P extends Number> Base.new(List<P> lr1,List<P> lr2) { this(); }
+ public <P,Q extends Number> Base.new(List<P> lp,Map<Q,P> m1) { this(); }
}
}
int Foo.foo(int n) { return n; }
- Foo.new(int w) {}
+ Foo.new(int w) { this(); }
int around(int n):
within(AdviceOnIntroduced) &&
}
aspect B {
- A.new(int i) {} // CE 10
+ A.new(int i) { this(); } // CE 10
}
}
aspect B {
- A.new(int i) {} // CE 10
+ A.new(int i) { this(); } // CE 10
}
runTest("no verify error with two this pcds");
}
+ public void testITDCWithNoExplicitConsCall() {
+ runTest("ITDC with no explicit cons call");
+ }
+
// helper methods.....
public SyntheticRepository createRepos(File cpentry) {
<ajc-test dir="bugs150" title="Problem with constructor ITDs">
<compile files="pr112783.aj" options="-1.5"/>
</ajc-test>
+
+ <ajc-test dir="bugs150" title="ITDC with no explicit cons call">
+ <compile files="Pr62606.aj" options="-1.5">
+ <message kind="warning" line="6" text="[Xlint:noExplicitConstructorCall]"/>
+ </compile>
+ </ajc-test>
<ajc-test dir="java5/generics/bugs" title="using same type variable in ITD">
<compile files="SameTypeVariable.aj" options="-1.5">
<ajc-test dir="bugs150/pr113947/case2" title="maws generic aspect - 2">
<compile files="AbstractListSupport.java,AnotherItem.java,Item.java,LinkedList.java,LinkedListItem.java,ListItem.java,StringList.java" options="-1.5"/>
</ajc-test>
-
+
<ajc-test dir="bugs150/pr113861" title="field-get problems with generic field">
<compile files="Test.java,TestAspect.java" options="-1.5"/>
<run class="com.Test"/>
<message kind="warning" text="void C.<init>(int) - already has an annotation of type Annotation, cannot add a second instance [Xlint:elementAlreadyAnnotated]"/>
</compile>
</ajc-test>
-
+
<ajc-test dir="bugs150/pr113630/case1" title="IncompatibleClassChangeError - errorscenario">
<compile files="Bean.java,BeanTestCase.java,javaBean.java,propertyChanger.java,PropertySupportAspect5.aj" options="-1.5">
<message kind="warning" line="9" text="Failing match because annotation 'javaBean' on type 'Bean' has SOURCE retention. Matching allowed when RetentionPolicy is CLASS or RUNTIME"/>
<ajc-test dir="base/test118" title="DEPRECATED: Introduce of constructors"
keywords="from-base">
- <compile files="Driver.java"/>
+ <compile files="Driver.java">
+ <message kind="warning" line="54" text="[Xlint:noExplicitConstructorCall]"/>
+ <message kind="warning" line="57" text="[Xlint:noExplicitConstructorCall]"/>
+ </compile>
<run class="Driver"/>
</ajc-test>