Lines 44-49
Link Here
|
44 |
import org.eclipse.jdt.core.compiler.CharOperation; |
44 |
import org.eclipse.jdt.core.compiler.CharOperation; |
45 |
import org.eclipse.jdt.core.compiler.InvalidInputException; |
45 |
import org.eclipse.jdt.core.compiler.InvalidInputException; |
46 |
import org.eclipse.jdt.core.compiler.IProblem; |
46 |
import org.eclipse.jdt.core.compiler.IProblem; |
|
|
47 |
import org.eclipse.jdt.internal.compiler.AbstractAnnotationProcessorManager; |
47 |
import org.eclipse.jdt.internal.compiler.ClassFile; |
48 |
import org.eclipse.jdt.internal.compiler.ClassFile; |
48 |
import org.eclipse.jdt.internal.compiler.CompilationResult; |
49 |
import org.eclipse.jdt.internal.compiler.CompilationResult; |
49 |
import org.eclipse.jdt.internal.compiler.Compiler; |
50 |
import org.eclipse.jdt.internal.compiler.Compiler; |
Lines 940-946
Link Here
|
940 |
this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$ |
941 |
this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$ |
941 |
} |
942 |
} |
942 |
} catch (FileNotFoundException e) { |
943 |
} catch (FileNotFoundException e) { |
943 |
throw new InvalidInputException(this.main.bind("configure.cannotOpenLog")); //$NON-NLS-1$ |
944 |
throw new InvalidInputException(this.main.bind("configure.cannotOpenLog", logFileName)); //$NON-NLS-1$ |
944 |
} |
945 |
} |
945 |
} |
946 |
} |
946 |
|
947 |
|
Lines 1151-1156
Link Here
|
1151 |
|
1152 |
|
1152 |
public boolean verbose = false; |
1153 |
public boolean verbose = false; |
1153 |
|
1154 |
|
|
|
1155 |
private String[] expandedCommandLine; |
1156 |
|
1157 |
private PrintWriter err; |
1158 |
|
1154 |
public Main(PrintWriter outWriter, PrintWriter errWriter, boolean systemExitWhenFinished) { |
1159 |
public Main(PrintWriter outWriter, PrintWriter errWriter, boolean systemExitWhenFinished) { |
1155 |
this(outWriter, errWriter, systemExitWhenFinished, null); |
1160 |
this(outWriter, errWriter, systemExitWhenFinished, null); |
1156 |
} |
1161 |
} |
Lines 1918-1923
Link Here
|
1918 |
final int INSIDE_SOURCE_PATH_start = 13; |
1923 |
final int INSIDE_SOURCE_PATH_start = 13; |
1919 |
final int INSIDE_ENDORSED_DIRS = 15; |
1924 |
final int INSIDE_ENDORSED_DIRS = 15; |
1920 |
final int INSIDE_SOURCE_DIRECTORY_DESTINATION_PATH = 16; |
1925 |
final int INSIDE_SOURCE_DIRECTORY_DESTINATION_PATH = 16; |
|
|
1926 |
final int INSIDE_PROCESSOR_PATH_start = 17; |
1927 |
final int INSIDE_PROCESSOR_start = 18; |
1928 |
final int INSIDE_S_start = 19; |
1921 |
|
1929 |
|
1922 |
final int DEFAULT = 0; |
1930 |
final int DEFAULT = 0; |
1923 |
ArrayList bootclasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH); |
1931 |
ArrayList bootclasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH); |
Lines 1996-2001
Link Here
|
1996 |
} |
2004 |
} |
1997 |
} |
2005 |
} |
1998 |
argCount = newCommandLineArgs.length; |
2006 |
argCount = newCommandLineArgs.length; |
|
|
2007 |
this.expandedCommandLine = newCommandLineArgs; |
1999 |
while (++index < argCount) { |
2008 |
while (++index < argCount) { |
2000 |
|
2009 |
|
2001 |
if (customEncoding != null) { |
2010 |
if (customEncoding != null) { |
Lines 2422-2427
Link Here
|
2422 |
this.logger.setEmacs(); |
2431 |
this.logger.setEmacs(); |
2423 |
continue; |
2432 |
continue; |
2424 |
} |
2433 |
} |
|
|
2434 |
// annotation processing |
2435 |
if (currentArg.startsWith("-A")) { //$NON-NLS-1$ |
2436 |
mode = DEFAULT; |
2437 |
continue; |
2438 |
} |
2439 |
if (currentArg.equals("-processorpath")) { //$NON-NLS-1$ |
2440 |
mode = INSIDE_PROCESSOR_PATH_start; |
2441 |
continue; |
2442 |
} |
2443 |
if (currentArg.equals("-processor")) { //$NON-NLS-1$ |
2444 |
mode = INSIDE_PROCESSOR_start; |
2445 |
continue; |
2446 |
} |
2447 |
if (currentArg.equals("-proc:only")) { //$NON-NLS-1$ |
2448 |
this.options.put( |
2449 |
CompilerOptions.OPTION_GenerateClassFiles, |
2450 |
CompilerOptions.DISABLED); |
2451 |
mode = DEFAULT; |
2452 |
continue; |
2453 |
} |
2454 |
if (currentArg.equals("-proc:none")) { //$NON-NLS-1$ |
2455 |
this.options.put( |
2456 |
CompilerOptions.OPTION_Process_Annotations, |
2457 |
CompilerOptions.DISABLED); |
2458 |
mode = DEFAULT; |
2459 |
continue; |
2460 |
} |
2461 |
if (currentArg.equals("-s")) { //$NON-NLS-1$ |
2462 |
mode = INSIDE_S_start; |
2463 |
continue; |
2464 |
} |
2465 |
if (currentArg.equals("-XprintProcessorInfo") //$NON-NLS-1$ |
2466 |
|| currentArg.equals("-XprintRounds")) { //$NON-NLS-1$ |
2467 |
mode = DEFAULT; |
2468 |
continue; |
2469 |
} |
2425 |
// tolerated javac options - quietly filtered out |
2470 |
// tolerated javac options - quietly filtered out |
2426 |
if (currentArg.startsWith("-X")) { //$NON-NLS-1$ |
2471 |
if (currentArg.startsWith("-X")) { //$NON-NLS-1$ |
2427 |
mode = DEFAULT; |
2472 |
mode = DEFAULT; |
Lines 2576-2582
Link Here
|
2576 |
this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ |
2621 |
this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ |
2577 |
"[-d " + currentArg)); //$NON-NLS-1$ |
2622 |
"[-d " + currentArg)); //$NON-NLS-1$ |
2578 |
} |
2623 |
} |
2579 |
// continue; fall through on purpose |
2624 |
break; |
|
|
2625 |
case INSIDE_PROCESSOR_PATH_start : |
2626 |
// nothing to do here. This is consumed again by the AnnotationProcessorManager |
2627 |
mode = DEFAULT; |
2628 |
continue; |
2629 |
case INSIDE_PROCESSOR_start : |
2630 |
// nothing to do here. This is consumed again by the AnnotationProcessorManager |
2631 |
mode = DEFAULT; |
2632 |
continue; |
2633 |
case INSIDE_S_start : |
2634 |
// nothing to do here. This is consumed again by the AnnotationProcessorManager |
2635 |
mode = DEFAULT; |
2636 |
continue; |
2580 |
} |
2637 |
} |
2581 |
|
2638 |
|
2582 |
// default is input directory, if no custom destination path exists |
2639 |
// default is input directory, if no custom destination path exists |
Lines 2678-2690
Link Here
|
2678 |
this.timesCounter = 0; |
2735 |
this.timesCounter = 0; |
2679 |
} |
2736 |
} |
2680 |
|
2737 |
|
2681 |
if (filesCount != 0) |
2738 |
if (filesCount != 0) { |
2682 |
System.arraycopy( |
2739 |
System.arraycopy( |
2683 |
this.filenames, |
2740 |
this.filenames, |
2684 |
0, |
2741 |
0, |
2685 |
(this.filenames = new String[filesCount]), |
2742 |
(this.filenames = new String[filesCount]), |
2686 |
0, |
2743 |
0, |
2687 |
filesCount); |
2744 |
filesCount); |
|
|
2745 |
} |
2688 |
|
2746 |
|
2689 |
setPaths(bootclasspaths, |
2747 |
setPaths(bootclasspaths, |
2690 |
sourcepathClasspathArg, |
2748 |
sourcepathClasspathArg, |
Lines 2857-2862
Link Here
|
2857 |
Map customDefaultOptions) { |
2915 |
Map customDefaultOptions) { |
2858 |
this.logger = new Logger(this, outWriter, errWriter); |
2916 |
this.logger = new Logger(this, outWriter, errWriter); |
2859 |
this.out = outWriter; |
2917 |
this.out = outWriter; |
|
|
2918 |
this.err = errWriter; |
2860 |
this.systemExitWhenFinished = systemExit; |
2919 |
this.systemExitWhenFinished = systemExit; |
2861 |
this.options = new CompilerOptions().getMap(); |
2920 |
this.options = new CompilerOptions().getMap(); |
2862 |
if (customDefaultOptions != null) { |
2921 |
if (customDefaultOptions != null) { |
Lines 2952-2957
Link Here
|
2952 |
getProblemFactory(), |
3011 |
getProblemFactory(), |
2953 |
this.out); |
3012 |
this.out); |
2954 |
|
3013 |
|
|
|
3014 |
if (this.compilerOptions.complianceLevel >= ClassFileConstants.JDK1_6 |
3015 |
&& this.compilerOptions.processAnnotations) { |
3016 |
initializeAnnotationProcessorManager(); |
3017 |
} |
3018 |
|
2955 |
// set the non-externally configurable options. |
3019 |
// set the non-externally configurable options. |
2956 |
this.compilerOptions.verbose = this.verbose; |
3020 |
this.compilerOptions.verbose = this.verbose; |
2957 |
this.compilerOptions.produceReferenceInfo = this.produceRefInfo; |
3021 |
this.compilerOptions.produceReferenceInfo = this.produceRefInfo; |
Lines 2967-2973
Link Here
|
2967 |
// cleanup |
3031 |
// cleanup |
2968 |
environment.cleanup(); |
3032 |
environment.cleanup(); |
2969 |
} |
3033 |
} |
2970 |
|
3034 |
protected void initializeAnnotationProcessorManager() { |
|
|
3035 |
try { |
3036 |
Class c = Class.forName("org.eclipse.jdt.internal.compiler.apt.dispatch.AnnotationProcessorManager"); //$NON-NLS-1$ |
3037 |
AbstractAnnotationProcessorManager annotationManager = (AbstractAnnotationProcessorManager) c.newInstance(); |
3038 |
annotationManager.configure(this, this.expandedCommandLine); |
3039 |
annotationManager.setErr(this.err); |
3040 |
annotationManager.setOut(this.out); |
3041 |
this.batchCompiler.annotationProcessorManager = annotationManager; |
3042 |
} catch (ClassNotFoundException e) { |
3043 |
// ignore |
3044 |
} catch (InstantiationException e) { |
3045 |
// should not happen |
3046 |
throw new org.eclipse.jdt.internal.compiler.problem.AbortCompilation(); |
3047 |
} catch (IllegalAccessException e) { |
3048 |
// should not happen |
3049 |
throw new org.eclipse.jdt.internal.compiler.problem.AbortCompilation(); |
3050 |
} |
3051 |
} |
2971 |
public void printUsage() { |
3052 |
public void printUsage() { |
2972 |
printUsage("misc.usage"); //$NON-NLS-1$ |
3053 |
printUsage("misc.usage"); //$NON-NLS-1$ |
2973 |
} |
3054 |
} |