aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorjlahoda <none@none>2014-01-15 13:49:57 +0100
committerjlahoda <none@none>2014-01-15 13:49:57 +0100
commitde7d8724b0445d70df2c09cb32ebd5ab7aa40fd6 (patch)
tree02fe7cd44dfa5ef088ed626b7fb95a149015e922 /test
parent7fcf9f5cd9e9c291b42da3c685451779e1a75b86 (diff)
8028576: Incorrect RuntimeVisibleTypeAnnotations for exception parameters when not generating debuging info
Summary: The exception parameters with type annotations need to be added into the varBuffer even if not generating debug info Reviewed-by: jjg, emc --HG-- extra : transplant_source : %C7%1C%B4%FB%B3%29%A0%15X%C6%96%CA%E1%E7%A5%07%C7%ED%5B%3D
Diffstat (limited to 'test')
-rw-r--r--test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java44
-rw-r--r--test/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java3
2 files changed, 30 insertions, 17 deletions
diff --git a/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java
index feaa4f3b..cb1ceafa 100644
--- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@ import java.io.PrintWriter;
import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -51,6 +52,11 @@ public class Driver {
new Driver().runDriver(clazz.newInstance());
}
+ String[][] extraParamsCombinations = new String[][] {
+ new String[] { },
+ new String[] { "-g" },
+ };
+
protected void runDriver(Object object) throws Exception {
int passed = 0, failed = 0;
Class<?> clazz = object.getClass();
@@ -65,18 +71,20 @@ public class Driver {
throw new IllegalArgumentException("Test method needs to return a string: " + method);
String testClass = testClassOf(method);
- try {
- String compact = (String)method.invoke(object);
- String fullFile = wrap(compact);
- ClassFile cf = compileAndReturn(fullFile, testClass);
- List<TypeAnnotation> actual = ReferenceInfoUtil.extendedAnnotationsOf(cf);
- ReferenceInfoUtil.compare(expected, actual, cf);
- out.println("PASSED: " + method.getName());
- ++passed;
- } catch (Throwable e) {
- out.println("FAILED: " + method.getName());
- out.println(" " + e.toString());
- ++failed;
+ for (String[] extraParams : extraParamsCombinations) {
+ try {
+ String compact = (String)method.invoke(object);
+ String fullFile = wrap(compact);
+ ClassFile cf = compileAndReturn(fullFile, testClass, extraParams);
+ List<TypeAnnotation> actual = ReferenceInfoUtil.extendedAnnotationsOf(cf);
+ ReferenceInfoUtil.compare(expected, actual, cf);
+ out.println("PASSED: " + method.getName());
+ ++passed;
+ } catch (Throwable e) {
+ out.println("FAILED: " + method.getName());
+ out.println(" " + e.toString());
+ ++failed;
+ }
}
}
@@ -156,7 +164,7 @@ public class Driver {
}
}
- private ClassFile compileAndReturn(String fullFile, String testClass) throws Exception {
+ private ClassFile compileAndReturn(String fullFile, String testClass, String... extraParams) throws Exception {
File source = writeTestFile(fullFile);
File clazzFile = compileTestFile(source, testClass);
return ClassFile.read(clazzFile);
@@ -170,8 +178,12 @@ public class Driver {
return f;
}
- protected File compileTestFile(File f, String testClass) {
- int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.8", "-g", f.getPath() });
+ protected File compileTestFile(File f, String testClass, String... extraParams) {
+ List<String> options = new ArrayList<>();
+ options.addAll(Arrays.asList("-source", "1.8"));
+ options.addAll(Arrays.asList(extraParams));
+ options.add(f.getPath());
+ int rc = com.sun.tools.javac.Main.compile(options.toArray(new String[options.size()]));
if (rc != 0)
throw new Error("compilation failed. rc=" + rc);
String path;
diff --git a/test/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java b/test/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java
index 790a5142..f41cff9a 100644
--- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@ import static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
/*
* @test
+ * @bug 8028576
* @summary Test population of reference info for exception parameters
* @author Werner Dietl
* @compile -g Driver.java ReferenceInfoUtil.java ExceptionParameters.java