Explorar el Código

266165: if(enabled) where enabled is constant boolean is optimized

tags/pre268419
aclement hace 15 años
padre
commit
cf9a42e2c3

+ 11
- 0
tests/bugs164/pr266165/AlwaysWeave.java Ver fichero

@@ -0,0 +1,11 @@
aspect A {

public static final boolean enabled = true;

before(): execution(* AlwaysWeave.*(..)) && if(enabled) {}

}

public class AlwaysWeave {
public void foo() {}
}

+ 10
- 0
tests/bugs164/pr266165/AlwaysWeave2.java Ver fichero

@@ -0,0 +1,10 @@
aspect A {


before(): execution(* AlwaysWeave2.*(..)) && if(true) {}

}

public class AlwaysWeave2 {
public void foo() {}
}

+ 11
- 0
tests/bugs164/pr266165/NeverWeave.java Ver fichero

@@ -0,0 +1,11 @@
aspect A {

public static final boolean enabled = false;

before(): execution(* NeverWeave.*(..)) && if(enabled) {}

}

public class NeverWeave {
public void foo() {}
}

+ 9
- 0
tests/bugs164/pr266165/NeverWeave2.java Ver fichero

@@ -0,0 +1,9 @@
aspect A {

before(): execution(* NeverWeave2.*(..)) && if(false) {}

}

public class NeverWeave2 {
public void foo() {}
}

+ 16
- 0
tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java Ver fichero

@@ -32,6 +32,22 @@ import org.aspectj.testing.XMLBasedAjcTestCase;

public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {

public void testOptimizingIf_pr266165_1() {
runTest("optimizing if for constant reference - 1");
}

public void testOptimizingIf_pr266165_2() {
runTest("optimizing if for constant reference - 2");
}

public void testOptimizingIf_pr266165_3() {
runTest("optimizing if for constant reference - 3");
}

public void testOptimizingIf_pr266165_4() {
runTest("optimizing if for constant reference - 4");
}

// public void testAnnoInherited_pr265695() {
// runTest("anno inherited");
// }

+ 20
- 0
tests/src/org/aspectj/systemtest/ajc164/ajc164.xml Ver fichero

@@ -1,6 +1,26 @@
<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>

<suite>
<ajc-test dir="bugs164/pr266165" title="optimizing if for constant reference - 1">
<compile files="NeverWeave.java" options="-1.5 -Xlint:ignore -showWeaveInfo"/>
</ajc-test>
<ajc-test dir="bugs164/pr266165" title="optimizing if for constant reference - 2">
<compile files="AlwaysWeave.java" options="-1.5 -showWeaveInfo">
<message kind="weave" text="Join point"/>
</compile>
</ajc-test>
<ajc-test dir="bugs164/pr266165" title="optimizing if for constant reference - 3">
<compile files="NeverWeave2.java" options="-1.5 -Xlint:ignore -showWeaveInfo"/>
</ajc-test>
<ajc-test dir="bugs164/pr266165" title="optimizing if for constant reference - 4">
<compile files="AlwaysWeave2.java" options="-1.5 -showWeaveInfo">
<message kind="weave" text="Join point"/>
</compile>
</ajc-test>

<ajc-test dir="bugs164/pr265695" title="anno inherited">
<compile files="Asp.aj" options="-showWeaveInfo -1.5">

Cargando…
Cancelar
Guardar