Lines 8-13
Link Here
|
8 |
* Contributors: |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
10 |
* Benjamin Muskalla - Contribution for bug 239066 |
10 |
* Benjamin Muskalla - Contribution for bug 239066 |
|
|
11 |
* Stephan Herrmann - Contribution for bug 236385 |
11 |
*******************************************************************************/ |
12 |
*******************************************************************************/ |
12 |
package org.eclipse.jdt.internal.compiler.impl; |
13 |
package org.eclipse.jdt.internal.compiler.impl; |
13 |
|
14 |
|
Lines 127-132
Link Here
|
127 |
public static final String OPTION_ReportDeadCode = "org.eclipse.jdt.core.compiler.problem.deadCode"; //$NON-NLS-1$ |
128 |
public static final String OPTION_ReportDeadCode = "org.eclipse.jdt.core.compiler.problem.deadCode"; //$NON-NLS-1$ |
128 |
public static final String OPTION_ReportDeadCodeInTrivialIfStatement = "org.eclipse.jdt.core.compiler.problem.deadCodeInTrivialIfStatement"; //$NON-NLS-1$ |
129 |
public static final String OPTION_ReportDeadCodeInTrivialIfStatement = "org.eclipse.jdt.core.compiler.problem.deadCodeInTrivialIfStatement"; //$NON-NLS-1$ |
129 |
public static final String OPTION_ReportTasks = "org.eclipse.jdt.core.compiler.problem.tasks"; //$NON-NLS-1$ |
130 |
public static final String OPTION_ReportTasks = "org.eclipse.jdt.core.compiler.problem.tasks"; //$NON-NLS-1$ |
|
|
131 |
public static final String OPTION_ReportUnusedObjectAllocation = "org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation"; //$NON-NLS-1$ |
130 |
|
132 |
|
131 |
// Backward compatibility |
133 |
// Backward compatibility |
132 |
public static final String OPTION_ReportInvalidAnnotation = "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"; //$NON-NLS-1$ |
134 |
public static final String OPTION_ReportInvalidAnnotation = "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"; //$NON-NLS-1$ |
Lines 232-237
Link Here
|
232 |
public static final int ShouldImplementHashcode = IrritantSet.GROUP2 | ASTNode.Bit1; |
234 |
public static final int ShouldImplementHashcode = IrritantSet.GROUP2 | ASTNode.Bit1; |
233 |
public static final int DeadCode = IrritantSet.GROUP2 | ASTNode.Bit2; |
235 |
public static final int DeadCode = IrritantSet.GROUP2 | ASTNode.Bit2; |
234 |
public static final int Tasks = IrritantSet.GROUP2 | ASTNode.Bit3; |
236 |
public static final int Tasks = IrritantSet.GROUP2 | ASTNode.Bit3; |
|
|
237 |
public static final int UnusedObjectAllocation = IrritantSet.GROUP2 | ASTNode.Bit4; |
235 |
|
238 |
|
236 |
// Severity level for handlers |
239 |
// Severity level for handlers |
237 |
/** |
240 |
/** |
Lines 515-520
Link Here
|
515 |
return OPTION_ReportMissingHashCodeMethod; |
518 |
return OPTION_ReportMissingHashCodeMethod; |
516 |
case DeadCode : |
519 |
case DeadCode : |
517 |
return OPTION_ReportDeadCode; |
520 |
return OPTION_ReportDeadCode; |
|
|
521 |
case UnusedObjectAllocation: |
522 |
return OPTION_ReportUnusedObjectAllocation; |
518 |
} |
523 |
} |
519 |
return null; |
524 |
return null; |
520 |
} |
525 |
} |
Lines 641-646
Link Here
|
641 |
OPTION_ReportUnusedDeclaredThrownException, |
646 |
OPTION_ReportUnusedDeclaredThrownException, |
642 |
OPTION_ReportUnusedImport, |
647 |
OPTION_ReportUnusedImport, |
643 |
OPTION_ReportUnusedLocal, |
648 |
OPTION_ReportUnusedLocal, |
|
|
649 |
OPTION_ReportUnusedObjectAllocation, |
644 |
OPTION_ReportUnusedParameter, |
650 |
OPTION_ReportUnusedParameter, |
645 |
OPTION_ReportUnusedPrivateMember, |
651 |
OPTION_ReportUnusedPrivateMember, |
646 |
OPTION_ReportVarargsArgumentNeedCast, |
652 |
OPTION_ReportVarargsArgumentNeedCast, |
Lines 701-706
Link Here
|
701 |
case UnusedPrivateMember : |
707 |
case UnusedPrivateMember : |
702 |
case UnusedDeclaredThrownException : |
708 |
case UnusedDeclaredThrownException : |
703 |
case DeadCode : |
709 |
case DeadCode : |
|
|
710 |
case UnusedObjectAllocation : |
704 |
return "unused"; //$NON-NLS-1$ |
711 |
return "unused"; //$NON-NLS-1$ |
705 |
case DiscouragedReference : |
712 |
case DiscouragedReference : |
706 |
case ForbiddenReference : |
713 |
case ForbiddenReference : |
Lines 891-896
Link Here
|
891 |
optionsMap.put(OPTION_ReportDeadCode, getSeverityString(DeadCode)); |
898 |
optionsMap.put(OPTION_ReportDeadCode, getSeverityString(DeadCode)); |
892 |
optionsMap.put(OPTION_ReportDeadCodeInTrivialIfStatement, this.reportDeadCodeInTrivialIfStatement ? ENABLED : DISABLED); |
899 |
optionsMap.put(OPTION_ReportDeadCodeInTrivialIfStatement, this.reportDeadCodeInTrivialIfStatement ? ENABLED : DISABLED); |
893 |
optionsMap.put(OPTION_ReportTasks, getSeverityString(Tasks)); |
900 |
optionsMap.put(OPTION_ReportTasks, getSeverityString(Tasks)); |
|
|
901 |
optionsMap.put(OPTION_ReportUnusedObjectAllocation, getSeverityString(UnusedObjectAllocation)); |
894 |
return optionsMap; |
902 |
return optionsMap; |
895 |
} |
903 |
} |
896 |
|
904 |
|
Lines 1287-1292
Link Here
|
1287 |
if ((optionValue = optionsMap.get(OPTION_ReportMissingHashCodeMethod)) != null) updateSeverity(ShouldImplementHashcode, optionValue); |
1295 |
if ((optionValue = optionsMap.get(OPTION_ReportMissingHashCodeMethod)) != null) updateSeverity(ShouldImplementHashcode, optionValue); |
1288 |
if ((optionValue = optionsMap.get(OPTION_ReportDeadCode)) != null) updateSeverity(DeadCode, optionValue); |
1296 |
if ((optionValue = optionsMap.get(OPTION_ReportDeadCode)) != null) updateSeverity(DeadCode, optionValue); |
1289 |
if ((optionValue = optionsMap.get(OPTION_ReportTasks)) != null) updateSeverity(Tasks, optionValue); |
1297 |
if ((optionValue = optionsMap.get(OPTION_ReportTasks)) != null) updateSeverity(Tasks, optionValue); |
|
|
1298 |
if ((optionValue = optionsMap.get(OPTION_ReportUnusedObjectAllocation)) != null) updateSeverity(UnusedObjectAllocation, optionValue); |
1290 |
|
1299 |
|
1291 |
// Javadoc options |
1300 |
// Javadoc options |
1292 |
if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) { |
1301 |
if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) { |
Lines 1488-1493
Link Here
|
1488 |
buf.append("\n\t- dead code: ").append(getSeverityString(DeadCode)); //$NON-NLS-1$ |
1497 |
buf.append("\n\t- dead code: ").append(getSeverityString(DeadCode)); //$NON-NLS-1$ |
1489 |
buf.append("\n\t- dead code in trivial if statement: ").append(this.reportDeadCodeInTrivialIfStatement ? ENABLED : DISABLED); //$NON-NLS-1$ |
1498 |
buf.append("\n\t- dead code in trivial if statement: ").append(this.reportDeadCodeInTrivialIfStatement ? ENABLED : DISABLED); //$NON-NLS-1$ |
1490 |
buf.append("\n\t- tasks severity: ").append(getSeverityString(Tasks)); //$NON-NLS-1$ |
1499 |
buf.append("\n\t- tasks severity: ").append(getSeverityString(Tasks)); //$NON-NLS-1$ |
|
|
1500 |
buf.append("\n\t- unused object allocation: ").append(getSeverityString(UnusedObjectAllocation)); //$NON-NLS-1$ |
1491 |
return buf.toString(); |
1501 |
return buf.toString(); |
1492 |
} |
1502 |
} |
1493 |
|
1503 |
|