소스 검색

@testcase PR#41175 aspect-declared methods with exception clauses fail in binary libraries

Corresponding non-binary passing tests added to ajcTests.xml
tags/V1_1_1
wisberg 21 년 전
부모
커밋
c09964fbdb

+ 30
- 0
tests/ajcTests.xml 파일 보기

@@ -6598,5 +6598,35 @@
<run class="Client"/>
</ajc-test>

<ajc-test
dir="bugs/interfaceLibrary"
title="exception clause for aspect-declared interface methods - positive">
<compile files="Client.java,LibraryAspect.java,lib/LibraryInterface.java"/>
<run class="Client"/>
</ajc-test>

<ajc-test
dir="bugs/interfaceLibrary"
title="exception clause for aspect-declared interface methods - negative">
<compile files="ClientCE.java,LibraryAspect.java,lib/LibraryInterface.java">
<message kind="error" file="ClientCE.java" line="5"/>
</compile>
</ajc-test>

<ajc-test
dir="bugs/interfaceLibrary"
title="exception clause for aspect-declared class methods - positive">
<compile files="ClassClient.java,LibraryClassAspect.java,lib/LibraryClass.java"/>
<run class="ClassClient"/>
</ajc-test>

<ajc-test
dir="bugs/interfaceLibrary"
title="exception clause for aspect-declared class methods - negative">
<compile files="ClassClientCE.java,LibraryClassAspect.java,lib/LibraryClass.java">
<message kind="error" file="ClassClientCE.java" line="5"/>
</compile>
</ajc-test>
</suite>

+ 30
- 0
tests/ajcTestsFailing.xml 파일 보기

@@ -12,4 +12,34 @@
<run class="Client"/>
</ajc-test>

<ajc-test dir="bugs/interfaceLibrary"
pr="41175"
title="exception clause for aspect-declared interface methods - positive binary">
<compile files="Client.java" aspectpath="lib.jar"/>
<run class="Client"/>
</ajc-test>

<ajc-test dir="bugs/interfaceLibrary"
pr="41175"
title="exception clause for aspect-declared interface methods - negative binary">
<compile files="ClientCE.java" aspectpath="lib.jar">
<message kind="error" file="ClientCE.java" line="5"/>
</compile>
</ajc-test>

<ajc-test dir="bugs/interfaceLibrary"
pr="41175"
title="exception clause for aspect-declared class methods - positive binary">
<compile files="ClassClient.java" aspectpath="libClass.jar"/>
<run class="Client"/>
</ajc-test>

<ajc-test dir="bugs/interfaceLibrary"
pr="41175"
title="exception clause for aspect-declared class methods - negative binary">
<compile files="ClassClientCE.java" aspectpath="libClass.jar">
<message kind="error" file="ClassClientCE.java" line="5"/>
</compile>
</ajc-test>
</suite>

+ 14
- 0
tests/bugs/interfaceLibrary/ClassClient.java 파일 보기

@@ -0,0 +1,14 @@

import java.io.IOException;

public class ClassClient {
public static void main(String[] a) {
try {
new C().run();
throw new Error("test failed to throw IOException");
} catch (IOException e) {
}
}
}

class C extends lib.LibraryClass {}

+ 9
- 0
tests/bugs/interfaceLibrary/ClassClientCE.java 파일 보기

@@ -0,0 +1,9 @@


public class ClassClientCE {
public static void main(String[] a) {
new C().run(); // CE 5 expected: declare IOException
}
}

class C extends lib.LibraryClass {}

+ 14
- 0
tests/bugs/interfaceLibrary/Client.java 파일 보기

@@ -0,0 +1,14 @@

import java.io.IOException;

public class Client {
public static void main(String[] a) {
try {
new C().run();
throw new Error("test failed to throw IOException");
} catch (IOException e) {
}
}
}

class C implements lib.LibraryInterface {}

+ 9
- 0
tests/bugs/interfaceLibrary/ClientCE.java 파일 보기

@@ -0,0 +1,9 @@


public class ClientCE {
public static void main(String[] a) {
new C().run(); // CE 5 expected: declare IOException
}
}

class C implements lib.LibraryInterface {}

+ 8
- 0
tests/bugs/interfaceLibrary/LibraryAspect.java 파일 보기

@@ -0,0 +1,8 @@

import java.io.IOException;

aspect LibraryAspect {
public void lib.LibraryInterface.run() throws IOException {
throw new IOException("LibraryAspect-defined run() for " + this);
}
}

+ 8
- 0
tests/bugs/interfaceLibrary/LibraryClassAspect.java 파일 보기

@@ -0,0 +1,8 @@

import java.io.IOException;

aspect LibraryClassAspect {
public void lib.LibraryClass.run() throws IOException {
throw new IOException("LibraryClassAspect-defined run() for " + this);
}
}

+ 70
- 0
tests/bugs/interfaceLibrary/build.xml 파일 보기

@@ -0,0 +1,70 @@

<project name="interfaceLibrary" default="build" basedir=".">

<!-- @testcase PR#41175 aspect-declared methods with exception clauses fail in binary libraries -->
<target name="build" depends="init">
<iajc
classpath="${aspectjrt.jar}"
outjar="lib.jar"
srcdir="."
includes="LibraryAspect.java,lib/LibraryInterface.java"/>

<iajc
classpath="${aspectjrt.jar}"
outjar="libClass.jar"
srcdir="."
includes="LibraryClassAspect.java,lib/LibraryClass.java"/>

</target>
<target name="init" depends="init.variables,init.taskdefs"/>

<target name="init.variables"
description="init variables">
<!-- required directories - run from examples or predefine -->
<property name="interfaceLibrary.dir"
location="${basedir}"/>
<property name="aspectj.lib.dir"
location="${interfaceLibrary.dir}/../../../aj-build/dist/tools/lib"/>

<!-- required libraries - install or predefine -->
<property name="aspectjrt.jar"
location="${aspectj.lib.dir}/aspectjrt.jar"/>
<property name="aspectjtools.jar"
location="${aspectj.lib.dir}/aspectjtools.jar"/>

<!-- checking required libraries -->
<available file="${aspectjtools.jar}"
property="aspectjtools.jar.available"/>
<available file="${aspectjrt.jar}"
property="aspectjrt.jar.available"/>

</target>

<target name="init.taskdefs" depends="init.variables,
aspectjtools.jar.available,
aspectjrt.jar.available"
unless="taskdefs.init">
<!-- sets name of new task to iajc, old task to ajc -->
<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
<classpath>
<pathelement path="${aspectjtools.jar}"/>
</classpath>
</taskdef>
<property name="taskdefs.init" value="true"/>
</target>

<!-- targets to fail unless required libraries available -->

<target name="aspectjrt.jar.available" depends="init.variables"
unless="aspectjrt.jar.available" >
<fail message="expecting aspectjrt.jar at ${aspectjrt.jar}"/>
</target>

<target name="aspectjtools.jar.available" depends="init.variables"
unless="aspectjtools.jar.available" >
<fail message="expecting aspectjtools.jar at ${aspectjtools.jar}"/>
</target>

</project>

BIN
tests/bugs/interfaceLibrary/lib.jar 파일 보기


+ 6
- 0
tests/bugs/interfaceLibrary/lib/LibraryClass.java 파일 보기

@@ -0,0 +1,6 @@

package lib;

public class LibraryClass {

}

+ 6
- 0
tests/bugs/interfaceLibrary/lib/LibraryInterface.java 파일 보기

@@ -0,0 +1,6 @@

package lib;

public interface LibraryInterface {

}

BIN
tests/bugs/interfaceLibrary/libClass.jar 파일 보기


Loading…
취소
저장