< prev index next >

test/tools/javac/diags/Example.java

Print this page




 219             opts.add("--class-path");
 220             opts.add(classpathDir.getAbsolutePath());
 221         }
 222 
 223         File classesDir = new File(tempDir, "classes");
 224         classesDir.mkdirs();
 225         clean(classesDir);
 226 
 227         opts.add("-d");
 228         opts.add(classesDir.getPath());
 229         if (options != null)
 230             opts.addAll(options);
 231 
 232         if (procFiles.size() > 0) {
 233             List<String> pOpts = new ArrayList<>(Arrays.asList("-d", classesDir.getPath()));
 234 
 235             // hack to automatically add exports; a better solution would be to grep the
 236             // source for import statements or a magic comment
 237             for (File pf: procFiles) {
 238                 if (pf.getName().equals("CreateBadClassFile.java")) {

 239                     pOpts.add("--add-exports=jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED");
 240                 }
 241             }
 242 
 243             new Jsr199Compiler(verbose).run(null, null, false, pOpts, procFiles);
 244             opts.add("-classpath"); // avoid using -processorpath for now
 245             opts.add(classesDir.getPath());
 246             createAnnotationServicesFile(classesDir, procFiles);
 247         } else if (options != null) {
 248             int i = options.indexOf("-processor");
 249             // check for built-in anno-processor(s)
 250             if (i != -1 && options.get(i + 1).equals("DocCommentProcessor")) {
 251                 opts.add("-classpath");
 252                 opts.add(System.getProperty("test.classes"));
 253             }
 254         }
 255 
 256         List<File> files = srcFiles;
 257 
 258         if (srcPathDir != null) {




 219             opts.add("--class-path");
 220             opts.add(classpathDir.getAbsolutePath());
 221         }
 222 
 223         File classesDir = new File(tempDir, "classes");
 224         classesDir.mkdirs();
 225         clean(classesDir);
 226 
 227         opts.add("-d");
 228         opts.add(classesDir.getPath());
 229         if (options != null)
 230             opts.addAll(options);
 231 
 232         if (procFiles.size() > 0) {
 233             List<String> pOpts = new ArrayList<>(Arrays.asList("-d", classesDir.getPath()));
 234 
 235             // hack to automatically add exports; a better solution would be to grep the
 236             // source for import statements or a magic comment
 237             for (File pf: procFiles) {
 238                 if (pf.getName().equals("CreateBadClassFile.java")) {
 239                     pOpts.add("--add-modules=jdk.jdeps");
 240                     pOpts.add("--add-exports=jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED");
 241                 }
 242             }
 243 
 244             new Jsr199Compiler(verbose).run(null, null, false, pOpts, procFiles);
 245             opts.add("-classpath"); // avoid using -processorpath for now
 246             opts.add(classesDir.getPath());
 247             createAnnotationServicesFile(classesDir, procFiles);
 248         } else if (options != null) {
 249             int i = options.indexOf("-processor");
 250             // check for built-in anno-processor(s)
 251             if (i != -1 && options.get(i + 1).equals("DocCommentProcessor")) {
 252                 opts.add("-classpath");
 253                 opts.add(System.getProperty("test.classes"));
 254             }
 255         }
 256 
 257         List<File> files = srcFiles;
 258 
 259         if (srcPathDir != null) {


< prev index next >