|
Lines 5-10
Link Here
|
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
7 |
* |
|
|
8 |
* This is an implementation of an early-draft specification developed under the Java |
| 9 |
* Community Process (JCP) and is made available for testing and evaluation purposes |
| 10 |
* only. The code is not compatible with any specification of the JCP. |
| 11 |
* |
| 8 |
* Contributors: |
12 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
13 |
* IBM Corporation - initial API and implementation |
| 10 |
* Benjamin Muskalla - Contribution for bug 239066 |
14 |
* Benjamin Muskalla - Contribution for bug 239066 |
|
Lines 136-141
Link Here
|
| 136 |
public static final String OPTION_IncludeNullInfoFromAsserts = "org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts"; //$NON-NLS-1$ |
140 |
public static final String OPTION_IncludeNullInfoFromAsserts = "org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts"; //$NON-NLS-1$ |
| 137 |
public static final String OPTION_ReportMethodCanBeStatic = "org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic"; //$NON-NLS-1$ |
141 |
public static final String OPTION_ReportMethodCanBeStatic = "org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic"; //$NON-NLS-1$ |
| 138 |
public static final String OPTION_ReportMethodCanBePotentiallyStatic = "org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic"; //$NON-NLS-1$ |
142 |
public static final String OPTION_ReportMethodCanBePotentiallyStatic = "org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic"; //$NON-NLS-1$ |
|
|
143 |
public static final String OPTION_ReportRedundantSpecificationOfTypeArguments = "org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments"; //$NON-NLS-1$ |
| 139 |
/** |
144 |
/** |
| 140 |
* Possible values for configurable options |
145 |
* Possible values for configurable options |
| 141 |
*/ |
146 |
*/ |
|
Lines 238-243
Link Here
|
| 238 |
public static final int UnusedObjectAllocation = IrritantSet.GROUP2 | ASTNode.Bit4; |
243 |
public static final int UnusedObjectAllocation = IrritantSet.GROUP2 | ASTNode.Bit4; |
| 239 |
public static final int MethodCanBeStatic = IrritantSet.GROUP2 | ASTNode.Bit5; |
244 |
public static final int MethodCanBeStatic = IrritantSet.GROUP2 | ASTNode.Bit5; |
| 240 |
public static final int MethodCanBePotentiallyStatic = IrritantSet.GROUP2 | ASTNode.Bit6; |
245 |
public static final int MethodCanBePotentiallyStatic = IrritantSet.GROUP2 | ASTNode.Bit6; |
|
|
246 |
public static final int RedundantSpecificationOfTypeArguments = IrritantSet.GROUP2 | ASTNode.Bit7; |
| 241 |
|
247 |
|
| 242 |
// Severity level for handlers |
248 |
// Severity level for handlers |
| 243 |
/** |
249 |
/** |
|
Lines 547-552
Link Here
|
| 547 |
return OPTION_ReportMethodCanBeStatic; |
553 |
return OPTION_ReportMethodCanBeStatic; |
| 548 |
case MethodCanBePotentiallyStatic : |
554 |
case MethodCanBePotentiallyStatic : |
| 549 |
return OPTION_ReportMethodCanBePotentiallyStatic; |
555 |
return OPTION_ReportMethodCanBePotentiallyStatic; |
|
|
556 |
case RedundantSpecificationOfTypeArguments : |
| 557 |
return OPTION_ReportRedundantSpecificationOfTypeArguments; |
| 550 |
} |
558 |
} |
| 551 |
return null; |
559 |
return null; |
| 552 |
} |
560 |
} |
|
Lines 682-687
Link Here
|
| 682 |
OPTION_ReportRawTypeReference, |
690 |
OPTION_ReportRawTypeReference, |
| 683 |
OPTION_ReportRedundantNullCheck, |
691 |
OPTION_ReportRedundantNullCheck, |
| 684 |
OPTION_ReportRedundantSuperinterface, |
692 |
OPTION_ReportRedundantSuperinterface, |
|
|
693 |
OPTION_ReportRedundantSpecificationOfTypeArguments, |
| 685 |
OPTION_ReportSpecialParameterHidingField, |
694 |
OPTION_ReportSpecialParameterHidingField, |
| 686 |
OPTION_ReportSyntheticAccessEmulation, |
695 |
OPTION_ReportSyntheticAccessEmulation, |
| 687 |
OPTION_ReportTasks, |
696 |
OPTION_ReportTasks, |
|
Lines 763-768
Link Here
|
| 763 |
case UnusedDeclaredThrownException : |
772 |
case UnusedDeclaredThrownException : |
| 764 |
case DeadCode : |
773 |
case DeadCode : |
| 765 |
case UnusedObjectAllocation : |
774 |
case UnusedObjectAllocation : |
|
|
775 |
case RedundantSpecificationOfTypeArguments : |
| 766 |
return "unused"; //$NON-NLS-1$ |
776 |
return "unused"; //$NON-NLS-1$ |
| 767 |
case DiscouragedReference : |
777 |
case DiscouragedReference : |
| 768 |
case ForbiddenReference : |
778 |
case ForbiddenReference : |
|
Lines 973-978
Link Here
|
| 973 |
optionsMap.put(OPTION_IncludeNullInfoFromAsserts, this.includeNullInfoFromAsserts ? ENABLED : DISABLED); |
983 |
optionsMap.put(OPTION_IncludeNullInfoFromAsserts, this.includeNullInfoFromAsserts ? ENABLED : DISABLED); |
| 974 |
optionsMap.put(OPTION_ReportMethodCanBeStatic, getSeverityString(MethodCanBeStatic)); |
984 |
optionsMap.put(OPTION_ReportMethodCanBeStatic, getSeverityString(MethodCanBeStatic)); |
| 975 |
optionsMap.put(OPTION_ReportMethodCanBePotentiallyStatic, getSeverityString(MethodCanBePotentiallyStatic)); |
985 |
optionsMap.put(OPTION_ReportMethodCanBePotentiallyStatic, getSeverityString(MethodCanBePotentiallyStatic)); |
|
|
986 |
optionsMap.put(OPTION_ReportRedundantSpecificationOfTypeArguments, getSeverityString(RedundantSpecificationOfTypeArguments)); |
| 976 |
return optionsMap; |
987 |
return optionsMap; |
| 977 |
} |
988 |
} |
| 978 |
|
989 |
|
|
Lines 1402-1407
Link Here
|
| 1402 |
if ((optionValue = optionsMap.get(OPTION_ReportUnusedObjectAllocation)) != null) updateSeverity(UnusedObjectAllocation, optionValue); |
1413 |
if ((optionValue = optionsMap.get(OPTION_ReportUnusedObjectAllocation)) != null) updateSeverity(UnusedObjectAllocation, optionValue); |
| 1403 |
if ((optionValue = optionsMap.get(OPTION_ReportMethodCanBeStatic)) != null) updateSeverity(MethodCanBeStatic, optionValue); |
1414 |
if ((optionValue = optionsMap.get(OPTION_ReportMethodCanBeStatic)) != null) updateSeverity(MethodCanBeStatic, optionValue); |
| 1404 |
if ((optionValue = optionsMap.get(OPTION_ReportMethodCanBePotentiallyStatic)) != null) updateSeverity(MethodCanBePotentiallyStatic, optionValue); |
1415 |
if ((optionValue = optionsMap.get(OPTION_ReportMethodCanBePotentiallyStatic)) != null) updateSeverity(MethodCanBePotentiallyStatic, optionValue); |
|
|
1416 |
if ((optionValue = optionsMap.get(OPTION_ReportRedundantSpecificationOfTypeArguments)) != null) updateSeverity(RedundantSpecificationOfTypeArguments, optionValue); |
| 1405 |
|
1417 |
|
| 1406 |
// Javadoc options |
1418 |
// Javadoc options |
| 1407 |
if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) { |
1419 |
if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) { |
|
Lines 1616-1621
Link Here
|
| 1616 |
buf.append("\n\t- unused object allocation: ").append(getSeverityString(UnusedObjectAllocation)); //$NON-NLS-1$ |
1628 |
buf.append("\n\t- unused object allocation: ").append(getSeverityString(UnusedObjectAllocation)); //$NON-NLS-1$ |
| 1617 |
buf.append("\n\t- method can be static: ").append(getSeverityString(MethodCanBeStatic)); //$NON-NLS-1$ |
1629 |
buf.append("\n\t- method can be static: ").append(getSeverityString(MethodCanBeStatic)); //$NON-NLS-1$ |
| 1618 |
buf.append("\n\t- method can be potentially static: ").append(getSeverityString(MethodCanBePotentiallyStatic)); //$NON-NLS-1$ |
1630 |
buf.append("\n\t- method can be potentially static: ").append(getSeverityString(MethodCanBePotentiallyStatic)); //$NON-NLS-1$ |
|
|
1631 |
buf.append("\n\t- redundant specification of type arguments: ").append(getSeverityString(RedundantSpecificationOfTypeArguments)); //$NON-NLS-1$ |
| 1619 |
return buf.toString(); |
1632 |
return buf.toString(); |
| 1620 |
} |
1633 |
} |
| 1621 |
|
1634 |
|