private void checkForBadVariableArgumentsUsage() { if (jdkVersion < 5) { throwParseException("Can't use variable arguments (varargs) when running in JDK 1.4 mode!"); } }
private void checkForBadAnnotationUsage() { if (jdkVersion < 5) { throwParseException("Can't use annotations when running in JDK 1.4 mode!"); } }
private void checkForBadLambdaUsage() { if (jdkVersion < 8) { throwParseException("Cannot use lambda expressions when running in JDK inferior to 1.8 mode!"); } } private void checkForBadMethodReferenceUsage() {
private void checkForBadDefaultImplementationUsage() { if (jdkVersion < 8) { throwParseException("Cannot use default implementations in interfaces when running in JDK inferior to 1.8 mode!"); } } private void checkForBadIntersectionTypesInCasts() {
private void checkforBadExplicitReceiverParameter() { if (jdkVersion < 8) { throwParseException("Cannot use explicit receiver parameters when running in JDK inferior to 1.8 mode!"); } } private void checkForBadAnonymousDiamondUsage() {
private void checkForBadHexFloatingPointLiteral() { if (jdkVersion < 5) { throwParseException("Can't use hexadecimal floating point literals in pre-JDK 1.5 target"); } }
private void checkForBadJDK15ForLoopSyntaxArgumentsUsage() { if (jdkVersion < 5) { throwParseException("Can't use JDK 1.5 for loop syntax when running in JDK 1.4 mode!"); } }
private void checkForBadDiamondUsage() { if (jdkVersion < 7) { throwParseException("Cannot use the diamond generic notation when running in JDK inferior to 1.7 mode!"); } }
private void checkForBadMultipleExceptionsCatching() { if (jdkVersion < 7) { throwParseException("Cannot catch multiple exceptions when running in JDK inferior to 1.7 mode!"); } }
private void checkForBadStaticImportUsage() { if (jdkVersion < 5) { throwParseException("Can't use static imports when running in JDK 1.4 mode!"); } }
private void checkForBadGenericsUsage() { if (jdkVersion < 5) { throwParseException("Can't use generics unless running in JDK 1.5 mode!"); } }
private void checkForBadTryWithResourcesUsage() { if (jdkVersion < 7) { throwParseException("Cannot use the try-with-resources notation when running in JDK inferior to 1.7 mode!"); } }
private void checkForBadMethodReferenceUsage() { if (jdkVersion < 8) { throwParseException("Cannot use method references when running in JDK inferior to 1.8 mode!"); } } private void checkForBadDefaultImplementationUsage() {
private void checkForBadTypeAnnotations() { if (jdkVersion < 8) { throwParseException("Cannot use type annotations when running in JDK inferior to 1.8 mode!"); } } private void checkforBadExplicitReceiverParameter() {
private void checkForBadConciseTryWithResourcesUsage() { if (jdkVersion < 9) { throwParseException("Cannot use concise try-with-resources when running in JDK inferior to 9 mode!"); } } private void checkForBadTypeIdentifierUsage(String image) {
private void checkForBadIdentifier(String image) { if (jdkVersion >= 9 && "_".equals(image)) { throwParseException("With JDK 9, '_' is a keyword, and may not be used as an identifier!"); } } private void checkForBadModuleUsage() {
private void checkForBadTypeIdentifierUsage(String image) { if (jdkVersion >= 10 && "var".equals(image)) { throwParseException("With JDK 10, 'var' is a restricted local variable type and cannot be used for type declarations!"); } }
private void checkForBadNumericalLiteralslUsage(Token token) { if (jdkVersion < 7) { if (token.image.contains("_")) { throwParseException("Can't use underscores in numerical literals when running in JDK inferior to 1.7 mode!"); } if (token.image.startsWith("0b") || token.image.startsWith("0B")) { throwParseException("Can't use binary numerical literals when running in JDK inferior to 1.7 mode!"); } } }
private void checkForBadPrivateInterfaceMethod(ASTMethodDeclaration node) { if (jdkVersion < 9 && inInterface && node.isPrivate()) { throwParseException("Cannot use private interface methods when running in JDK inferior to 9 mode!"); } } private void checkForBadIdentifier(String image) {
private void checkForBadAnonymousDiamondUsage() { if (jdkVersion < 9) { ASTAllocationExpression node = (ASTAllocationExpression)jjtree.peekNode(); ASTTypeArguments types = node.getFirstChildOfType(ASTClassOrInterfaceType.class).getFirstChildOfType(ASTTypeArguments.class); if (node.isAnonymousClass() && types != null && types.isDiamond()) { throwParseException("Cannot use '<>' with anonymous inner classes when running in JDK inferior to 9 mode!"); } } } /**