langtools/src/share/classes/com/sun/tools/javah/JavahTask.java
changeset 13690 8be9ba21c4a9
parent 10192 378321489bea
child 13844 56339cf983a3
equal deleted inserted replaced
13689:4d519199a6aa 13690:8be9ba21c4a9
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   504 
   504 
   505         JavaCompiler c = ToolProvider.getSystemJavaCompiler();
   505         JavaCompiler c = ToolProvider.getSystemJavaCompiler();
   506         List<String> opts = new ArrayList<String>();
   506         List<String> opts = new ArrayList<String>();
   507         opts.add("-proc:only");
   507         opts.add("-proc:only");
   508         opts.addAll(javac_extras);
   508         opts.addAll(javac_extras);
   509         CompilationTask t = c.getTask(log, fileManager, diagnosticListener, opts, internalize(classes), null);
   509         CompilationTask t = c.getTask(log, fileManager, diagnosticListener, opts, classes, null);
   510         JavahProcessor p = new JavahProcessor(g);
   510         JavahProcessor p = new JavahProcessor(g);
   511         t.setProcessors(Collections.singleton(p));
   511         t.setProcessors(Collections.singleton(p));
   512 
   512 
   513         boolean ok = t.call();
   513         boolean ok = t.call();
   514         if (p.exit != null)
   514         if (p.exit != null)
   515             throw new Util.Exit(p.exit);
   515             throw new Util.Exit(p.exit);
   516         return ok;
   516         return ok;
   517     }
       
   518 
       
   519     private List<String> internalize(List<String> classes) {
       
   520         List<String> l = new ArrayList<String>();
       
   521         for (String c: classes) {
       
   522             l.add(c.replace('$', '.'));
       
   523         }
       
   524         return l;
       
   525     }
   517     }
   526 
   518 
   527     private List<File> pathToFiles(String path) {
   519     private List<File> pathToFiles(String path) {
   528         List<File> files = new ArrayList<File>();
   520         List<File> files = new ArrayList<File>();
   529         for (String f: path.split(File.pathSeparator)) {
   521         for (String f: path.split(File.pathSeparator)) {