Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2005, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2005, 2010 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 104-110
Link Here
|
104 |
|
104 |
|
105 |
protected ArrayList fProblemList = new ArrayList(); |
105 |
protected ArrayList fProblemList = new ArrayList(); |
106 |
protected int fBuildSeverity; |
106 |
protected int fBuildSeverity; |
107 |
private int fClasspathSeverity; |
107 |
protected int fClasspathSeverity; |
|
|
108 |
protected int fJavaComplSeverity; |
109 |
protected int fSrcInclSeverity; |
110 |
protected int fBinInclSeverity; |
111 |
protected int fMissingOutputLibSeverity; |
112 |
protected int fSrcLibSeverity; |
113 |
protected int fOututLibSeverity; |
108 |
|
114 |
|
109 |
public BuildErrorReporter(IFile buildFile) { |
115 |
public BuildErrorReporter(IFile buildFile) { |
110 |
super(buildFile); |
116 |
super(buildFile); |
Lines 113-120
Link Here
|
113 |
public void validate(IProgressMonitor monitor) { |
119 |
public void validate(IProgressMonitor monitor) { |
114 |
fBuildSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD); |
120 |
fBuildSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD); |
115 |
fClasspathSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_UNRESOLVED_IMPORTS); |
121 |
fClasspathSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_UNRESOLVED_IMPORTS); |
116 |
if (fBuildSeverity == CompilerFlags.IGNORE && fClasspathSeverity == CompilerFlags.IGNORE) |
122 |
fMissingOutputLibSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_MISSING_OUTPUT); |
117 |
return; |
123 |
fSrcLibSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_SOURCE_LIBRARY); |
|
|
124 |
fOututLibSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_OUTPUT_LIBRARY); |
125 |
fJavaComplSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_JAVA_COMPLIANCE); |
126 |
fSrcInclSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_SRC_INCLUDES); |
127 |
fBinInclSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_BIN_INCLUDES); |
128 |
|
129 |
/*if (fBuildSeverity == CompilerFlags.IGNORE && fClasspathSeverity == CompilerFlags.IGNORE) |
130 |
return;*/ |
118 |
WorkspaceBuildModel wbm = new WorkspaceBuildModel(fFile); |
131 |
WorkspaceBuildModel wbm = new WorkspaceBuildModel(fFile); |
119 |
wbm.load(); |
132 |
wbm.load(); |
120 |
if (!wbm.isLoaded()) |
133 |
if (!wbm.isLoaded()) |
Lines 198-207
Link Here
|
198 |
|
211 |
|
199 |
if (jarsExtra != null) |
212 |
if (jarsExtra != null) |
200 |
validateJarsExtraClasspath(jarsExtra); |
213 |
validateJarsExtraClasspath(jarsExtra); |
201 |
validateIncludes(binIncludes, sourceEntryKeys); |
214 |
validateIncludes(binIncludes, sourceEntryKeys, fBinInclSeverity); |
202 |
validateIncludes(binExcludes, sourceEntryKeys); |
215 |
validateIncludes(binExcludes, sourceEntryKeys, fBinInclSeverity); |
203 |
validateIncludes(srcIncludes, sourceEntryKeys); |
216 |
validateIncludes(srcIncludes, sourceEntryKeys, fSrcInclSeverity); |
204 |
validateIncludes(srcExcludes, sourceEntryKeys); |
217 |
validateIncludes(srcExcludes, sourceEntryKeys, fSrcInclSeverity); |
205 |
validateSourceFoldersInSrcIncludes(srcIncludes); |
218 |
validateSourceFoldersInSrcIncludes(srcIncludes); |
206 |
|
219 |
|
207 |
try { |
220 |
try { |
Lines 292-321
Link Here
|
292 |
if (projectJavaCompatibility != null) { |
305 |
if (projectJavaCompatibility != null) { |
293 |
if (jreCompilationProfileEntry == null) { |
306 |
if (jreCompilationProfileEntry == null) { |
294 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry, PROPERTY_JRE_COMPILATION_PROFILE, PDECoreMessages.BuildErrorReporter_CompilercomplianceLevel); |
307 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry, PROPERTY_JRE_COMPILATION_PROFILE, PDECoreMessages.BuildErrorReporter_CompilercomplianceLevel); |
295 |
prepareError(PROPERTY_JRE_COMPILATION_PROFILE, projectJavaCompatibility, message, PDEMarkerFactory.B_ADDDITION, PDEMarkerFactory.CAT_EE); |
308 |
prepareError(PROPERTY_JRE_COMPILATION_PROFILE, projectJavaCompatibility, message, PDEMarkerFactory.B_ADDDITION, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); |
296 |
} else { |
309 |
} else { |
297 |
if (!projectJavaCompatibility.equalsIgnoreCase(jreCompilationProfileEntry.getTokens()[0])) { |
310 |
if (!projectJavaCompatibility.equalsIgnoreCase(jreCompilationProfileEntry.getTokens()[0])) { |
298 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken, PROPERTY_JRE_COMPILATION_PROFILE, PDECoreMessages.BuildErrorReporter_CompilercomplianceLevel); |
311 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken, PROPERTY_JRE_COMPILATION_PROFILE, PDECoreMessages.BuildErrorReporter_CompilercomplianceLevel); |
299 |
prepareError(PROPERTY_JRE_COMPILATION_PROFILE, projectJavaCompatibility, message, PDEMarkerFactory.B_REPLACE, PDEMarkerFactory.CAT_EE); |
312 |
prepareError(PROPERTY_JRE_COMPILATION_PROFILE, projectJavaCompatibility, message, PDEMarkerFactory.B_REPLACE, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); |
300 |
} |
313 |
} |
301 |
} |
314 |
} |
302 |
} else { |
315 |
} else { |
303 |
if (javacSourceEntry == null) { |
316 |
if (javacSourceEntry == null) { |
304 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry, PROPERTY_JAVAC_SOURCE, PDECoreMessages.BuildErrorReporter_SourceCompatibility); |
317 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry, PROPERTY_JAVAC_SOURCE, PDECoreMessages.BuildErrorReporter_SourceCompatibility); |
305 |
prepareError(PROPERTY_JAVAC_SOURCE, projectSourceCompatibility, message, PDEMarkerFactory.B_ADDDITION, PDEMarkerFactory.CAT_EE); |
318 |
prepareError(PROPERTY_JAVAC_SOURCE, projectSourceCompatibility, message, PDEMarkerFactory.B_ADDDITION, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); |
306 |
} else { |
319 |
} else { |
307 |
if (!projectSourceCompatibility.equalsIgnoreCase(javacSourceEntry.getTokens()[0])) { |
320 |
if (!projectSourceCompatibility.equalsIgnoreCase(javacSourceEntry.getTokens()[0])) { |
308 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken, PROPERTY_JAVAC_SOURCE, PDECoreMessages.BuildErrorReporter_SourceCompatibility); |
321 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken, PROPERTY_JAVAC_SOURCE, PDECoreMessages.BuildErrorReporter_SourceCompatibility); |
309 |
prepareError(PROPERTY_JAVAC_SOURCE, projectSourceCompatibility, message, PDEMarkerFactory.B_REPLACE, PDEMarkerFactory.CAT_EE); |
322 |
prepareError(PROPERTY_JAVAC_SOURCE, projectSourceCompatibility, message, PDEMarkerFactory.B_REPLACE, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); |
310 |
} |
323 |
} |
311 |
} |
324 |
} |
312 |
if (javacTargetEntry == null) { |
325 |
if (javacTargetEntry == null) { |
313 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry, PROPERTY_JAVAC_TARGET, PDECoreMessages.BuildErrorReporter_GeneratedClassFilesCompatibility); |
326 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry, PROPERTY_JAVAC_TARGET, PDECoreMessages.BuildErrorReporter_GeneratedClassFilesCompatibility); |
314 |
prepareError(PROPERTY_JAVAC_TARGET, projectClassCompatibility, message, PDEMarkerFactory.B_ADDDITION, PDEMarkerFactory.CAT_EE); |
327 |
prepareError(PROPERTY_JAVAC_TARGET, projectClassCompatibility, message, PDEMarkerFactory.B_ADDDITION, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); |
315 |
} else { |
328 |
} else { |
316 |
if (!projectClassCompatibility.equalsIgnoreCase(javacTargetEntry.getTokens()[0])) { |
329 |
if (!projectClassCompatibility.equalsIgnoreCase(javacTargetEntry.getTokens()[0])) { |
317 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken, PROPERTY_JAVAC_TARGET, PDECoreMessages.BuildErrorReporter_GeneratedClassFilesCompatibility); |
330 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken, PROPERTY_JAVAC_TARGET, PDECoreMessages.BuildErrorReporter_GeneratedClassFilesCompatibility); |
318 |
prepareError(PROPERTY_JAVAC_TARGET, projectClassCompatibility, message, PDEMarkerFactory.B_REPLACE, PDEMarkerFactory.CAT_EE); |
331 |
prepareError(PROPERTY_JAVAC_TARGET, projectClassCompatibility, message, PDEMarkerFactory.B_REPLACE, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); |
319 |
} |
332 |
} |
320 |
} |
333 |
} |
321 |
} |
334 |
} |
Lines 341-347
Link Here
|
341 |
if (javacWarningsEntry == null) { |
354 |
if (javacWarningsEntry == null) { |
342 |
if (warningToken.length() > 0) { |
355 |
if (warningToken.length() > 0) { |
343 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry, PROPERTY_JAVAC_WARNINGS_PREFIX, PDECoreMessages.BuildErrorReporter_DisallowIdentifiers); |
356 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry, PROPERTY_JAVAC_WARNINGS_PREFIX, PDECoreMessages.BuildErrorReporter_DisallowIdentifiers); |
344 |
prepareError(JAVAC_WARNINGS_ENTRY, warningToken, message, PDEMarkerFactory.B_ADDDITION, PDEMarkerFactory.CAT_EE); |
357 |
prepareError(JAVAC_WARNINGS_ENTRY, warningToken, message, PDEMarkerFactory.B_ADDDITION, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); |
345 |
} |
358 |
} |
346 |
} else { |
359 |
} else { |
347 |
if (javacWarningsEntry.contains(ASSERT_IDENTIFIER) || javacWarningsEntry.contains('+' + ASSERT_IDENTIFIER) || javacWarningsEntry.contains('-' + ASSERT_IDENTIFIER)) { |
360 |
if (javacWarningsEntry.contains(ASSERT_IDENTIFIER) || javacWarningsEntry.contains('+' + ASSERT_IDENTIFIER) || javacWarningsEntry.contains('-' + ASSERT_IDENTIFIER)) { |
Lines 355-361
Link Here
|
355 |
warningToken = join(assertToken, enumToken); |
368 |
warningToken = join(assertToken, enumToken); |
356 |
if (warningToken.length() > 0) { |
369 |
if (warningToken.length() > 0) { |
357 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken, PROPERTY_JAVAC_WARNINGS_PREFIX, PDECoreMessages.BuildErrorReporter_DisallowIdentifiers); |
370 |
message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken, PROPERTY_JAVAC_WARNINGS_PREFIX, PDECoreMessages.BuildErrorReporter_DisallowIdentifiers); |
358 |
prepareError(JAVAC_WARNINGS_ENTRY, warningToken, message, PDEMarkerFactory.B_ADDDITION, PDEMarkerFactory.CAT_EE); |
371 |
prepareError(JAVAC_WARNINGS_ENTRY, warningToken, message, PDEMarkerFactory.B_ADDDITION, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); |
359 |
} |
372 |
} |
360 |
} |
373 |
} |
361 |
} |
374 |
} |
Lines 486-492
Link Here
|
486 |
} |
499 |
} |
487 |
|
500 |
|
488 |
if (!exists) { |
501 |
if (!exists) { |
489 |
prepareError(PROPERTY_BIN_INCLUDES, key, NLS.bind(PDECoreMessages.BuildErrorReporter_binIncludesMissing, key), PDEMarkerFactory.B_ADDDITION, PDEMarkerFactory.CAT_FATAL); |
502 |
prepareError(PROPERTY_BIN_INCLUDES, key, NLS.bind(PDECoreMessages.BuildErrorReporter_binIncludesMissing, key), PDEMarkerFactory.B_ADDDITION, fBinInclSeverity, PDEMarkerFactory.CAT_FATAL); |
490 |
} |
503 |
} |
491 |
} |
504 |
} |
492 |
|
505 |
|
Lines 550-556
Link Here
|
550 |
found = true; |
563 |
found = true; |
551 |
} |
564 |
} |
552 |
if (!found) |
565 |
if (!found) |
553 |
prepareError(PROPERTY_BIN_INCLUDES, key, NLS.bind(PDECoreMessages.BuildErrorReporter_binIncludesMissing, key), PDEMarkerFactory.B_ADDDITION, PDEMarkerFactory.CAT_FATAL); |
566 |
prepareError(PROPERTY_BIN_INCLUDES, key, NLS.bind(PDECoreMessages.BuildErrorReporter_binIncludesMissing, key), PDEMarkerFactory.B_ADDDITION, fBinInclSeverity, PDEMarkerFactory.CAT_FATAL); |
554 |
} |
567 |
} |
555 |
} |
568 |
} |
556 |
|
569 |
|
Lines 565-571
Link Here
|
565 |
for (int i = 0; i < cpes.length; i++) { |
578 |
for (int i = 0; i < cpes.length; i++) { |
566 |
if (cpes[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) { |
579 |
if (cpes[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) { |
567 |
if (!sourceEntryKeys.contains(DEF_SOURCE_ENTRY)) |
580 |
if (!sourceEntryKeys.contains(DEF_SOURCE_ENTRY)) |
568 |
prepareError(DEF_SOURCE_ENTRY, null, PDECoreMessages.BuildErrorReporter_sourceMissing, PDEMarkerFactory.NO_RESOLUTION, PDEMarkerFactory.CAT_OTHER); |
581 |
prepareError(DEF_SOURCE_ENTRY, null, PDECoreMessages.BuildErrorReporter_sourceMissing, PDEMarkerFactory.NO_RESOLUTION, fSrcInclSeverity, PDEMarkerFactory.CAT_OTHER); |
569 |
break; |
582 |
break; |
570 |
} |
583 |
} |
571 |
} |
584 |
} |
Lines 579-585
Link Here
|
579 |
for (int j = 0; j < cpes.length; j++) { |
592 |
for (int j = 0; j < cpes.length; j++) { |
580 |
if (cpes[j].getEntryKind() == IClasspathEntry.CPE_SOURCE) { |
593 |
if (cpes[j].getEntryKind() == IClasspathEntry.CPE_SOURCE) { |
581 |
if (!sourceEntryKeys.contains(DEF_SOURCE_ENTRY)) |
594 |
if (!sourceEntryKeys.contains(DEF_SOURCE_ENTRY)) |
582 |
prepareError(DEF_SOURCE_ENTRY, null, PDECoreMessages.BuildErrorReporter_sourceMissing, PDEMarkerFactory.NO_RESOLUTION, PDEMarkerFactory.CAT_OTHER); |
595 |
prepareError(DEF_SOURCE_ENTRY, null, PDECoreMessages.BuildErrorReporter_sourceMissing, PDEMarkerFactory.NO_RESOLUTION, fSrcInclSeverity, PDEMarkerFactory.CAT_OTHER); |
583 |
break; |
596 |
break; |
584 |
} |
597 |
} |
585 |
} |
598 |
} |
Lines 650-658
Link Here
|
650 |
return; |
663 |
return; |
651 |
if (sourceEntries.size() == 1) { |
664 |
if (sourceEntries.size() == 1) { |
652 |
String name = ((IBuildEntry) sourceEntries.get(0)).getName(); |
665 |
String name = ((IBuildEntry) sourceEntries.get(0)).getName(); |
653 |
prepareError(name, null, NLS.bind(PDECoreMessages.BuildErrorReporter_classpathEntryMissing1, unlistedEntries, name), PDEMarkerFactory.B_SOURCE_ADDITION, PDEMarkerFactory.CAT_OTHER); |
666 |
prepareError(name, null, NLS.bind(PDECoreMessages.BuildErrorReporter_classpathEntryMissing1, unlistedEntries, name), PDEMarkerFactory.B_SOURCE_ADDITION, fSrcLibSeverity, PDEMarkerFactory.CAT_OTHER); |
654 |
} else |
667 |
} else |
655 |
prepareError(DEF_SOURCE_ENTRY, null, NLS.bind(PDECoreMessages.BuildErrorReporter_classpathEntryMissing, unlistedEntries), PDEMarkerFactory.B_SOURCE_ADDITION, PDEMarkerFactory.CAT_OTHER); |
668 |
prepareError(DEF_SOURCE_ENTRY, null, NLS.bind(PDECoreMessages.BuildErrorReporter_classpathEntryMissing, unlistedEntries), PDEMarkerFactory.B_SOURCE_ADDITION, fSrcLibSeverity, PDEMarkerFactory.CAT_OTHER); |
656 |
|
669 |
|
657 |
} |
670 |
} |
658 |
|
671 |
|
Lines 689-701
Link Here
|
689 |
} |
702 |
} |
690 |
|
703 |
|
691 |
if (errorMessage != null) { |
704 |
if (errorMessage != null) { |
692 |
prepareError(includes.getName(), tokens[i], errorMessage, PDEMarkerFactory.B_REMOVAL, PDEMarkerFactory.CAT_OTHER); |
705 |
prepareError(includes.getName(), tokens[i], errorMessage, PDEMarkerFactory.B_REMOVAL, fSrcInclSeverity, PDEMarkerFactory.CAT_OTHER); |
693 |
} |
706 |
} |
694 |
} |
707 |
} |
695 |
|
708 |
|
696 |
} |
709 |
} |
697 |
|
710 |
|
698 |
private void validateIncludes(IBuildEntry includes, ArrayList sourceIncludes) { |
711 |
private void validateIncludes(IBuildEntry includes, ArrayList sourceIncludes, int severity) { |
699 |
if (includes == null) |
712 |
if (includes == null) |
700 |
return; |
713 |
return; |
701 |
String[] tokens = includes.getTokens(); |
714 |
String[] tokens = includes.getTokens(); |
Lines 730-736
Link Here
|
730 |
} |
743 |
} |
731 |
|
744 |
|
732 |
if (message != null) |
745 |
if (message != null) |
733 |
prepareError(includes.getName(), token, message, fixId, PDEMarkerFactory.CAT_OTHER); |
746 |
prepareError(includes.getName(), token, message, fixId, severity, PDEMarkerFactory.CAT_OTHER); |
734 |
} |
747 |
} |
735 |
} |
748 |
} |
736 |
|
749 |
|