当前位置: 首页>>代码示例>>Java>>正文


Java ClassFileConstants.JDK1_7属性代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.JDK1_7属性的典型用法代码示例。如果您正苦于以下问题:Java ClassFileConstants.JDK1_7属性的具体用法?Java ClassFileConstants.JDK1_7怎么用?Java ClassFileConstants.JDK1_7使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants的用法示例。


在下文中一共展示了ClassFileConstants.JDK1_7属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toClassFmt

private long toClassFmt(final JavaVersion version) {
  if (version != null) {
    switch (version) {
      case JAVA5:
        return ClassFileConstants.JDK1_5;
      case JAVA6:
        return ClassFileConstants.JDK1_6;
      case JAVA7:
        return ClassFileConstants.JDK1_7;
      case JAVA8:
        return (((ClassFileConstants.MAJOR_VERSION_1_7 + 1) << 16) + ClassFileConstants.MINOR_VERSION_0);
      case JAVA9:
        return (((ClassFileConstants.MAJOR_VERSION_1_7 + 2) << 16) + ClassFileConstants.MINOR_VERSION_0);
      default:
        break;
    }
  }
  return 0;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:19,代码来源:InMemoryJavaCompiler.java

示例2: parse

@Nullable
private static Node parse(String code) {
  CompilerOptions options = new CompilerOptions();
  options.complianceLevel = options.sourceLevel = options.targetJDK = ClassFileConstants.JDK1_7;
  options.parseLiteralExpressionsAsConstants = true;
  ProblemReporter problemReporter = new ProblemReporter(
    DefaultErrorHandlingPolicies.exitOnFirstError(), options, new DefaultProblemFactory());
  Parser parser = new Parser(problemReporter, options.parseLiteralExpressionsAsConstants);
  parser.javadocParser.checkDocComment = false;
  EcjTreeConverter converter = new EcjTreeConverter();
  org.eclipse.jdt.internal.compiler.batch.CompilationUnit sourceUnit =
    new org.eclipse.jdt.internal.compiler.batch.CompilationUnit(code.toCharArray(), "unitTest", "UTF-8");
  CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
  CompilationUnitDeclaration unit = parser.parse(sourceUnit, compilationResult);
  if (unit == null) {
    return null;
  }
  converter.visit(code, unit);
  List<? extends Node> nodes = converter.getAll();
  for (lombok.ast.Node node : nodes) {
    if (node instanceof lombok.ast.CompilationUnit) {
      return node;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:LombokPsiConverterTest.java

示例3: DocCommentParser

DocCommentParser(AST ast, Scanner scanner, boolean check) {
	super(null);
	this.ast = ast;
	this.scanner = scanner;
	switch(this.ast.apiLevel()) {
		case AST.JLS2_INTERNAL :
			this.sourceLevel = ClassFileConstants.JDK1_3;
			break;
		case AST.JLS3_INTERNAL:
			this.sourceLevel = ClassFileConstants.JDK1_5;
			break;
		default:
			// AST.JLS4 for now
			this.sourceLevel = ClassFileConstants.JDK1_7;
	}
	this.checkDocComment = check;
	this.kind = DOM_PARSER | TEXT_PARSE;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:DocCommentParser.java

示例4: isValidPackageNameForClass

private  boolean isValidPackageNameForClass(String className) {
	char[] classNameArray = className.toCharArray();
	// use 1.7 as the source level as there are more valid identifiers in 1.7 mode
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=376673
	if (this.scanner == null)
		this.scanner = new Scanner(false /* comment */, true /* whitespace */, false /* nls */,
				ClassFileConstants.JDK1_7/* sourceLevel */, null/* taskTag */, null/* taskPriorities */, true /* taskCaseSensitive */);
	
	this.scanner.setSource(classNameArray); 
	this.scanner.eofPosition = classNameArray.length - SuffixConstants.SUFFIX_CLASS.length;
	try {
		if (isIdentifier()) {
			while (this.scanner.eofPosition > this.scanner.currentPosition) {
				if (this.scanner.getNextChar() != '/' || this.scanner.eofPosition <= this.scanner.currentPosition) {
					return false;
				}
				if (!isIdentifier()) return false;
			}
			return true;
		}
	} catch (InvalidInputException e) {
		// invalid class name
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:25,代码来源:AddJarFileToIndex.java

示例5: consumeDigits

private final void consumeDigits(int radix, boolean expectingDigitFirst) throws InvalidInputException {
	final int USING_UNDERSCORE = 1;
	final int INVALID_POSITION = 2;
	switch(consumeDigits0(radix, USING_UNDERSCORE, INVALID_POSITION, expectingDigitFirst)) {
		case USING_UNDERSCORE :
			if (this.sourceLevel < ClassFileConstants.JDK1_7) {
				throw new InvalidInputException(UNDERSCORES_IN_LITERALS_NOT_BELOW_17);
			}
			break;
		case INVALID_POSITION :
			if (this.sourceLevel < ClassFileConstants.JDK1_7) {
				throw new InvalidInputException(UNDERSCORES_IN_LITERALS_NOT_BELOW_17);
			}
			throw new InvalidInputException(INVALID_UNDERSCORE);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:Scanner.java

示例6: parameterCompatibilityLevel

private int parameterCompatibilityLevel(TypeBinding arg, TypeBinding param, LookupEnvironment env, boolean tieBreakingVarargsMethods) {
	// only called if env.options.sourceLevel >= ClassFileConstants.JDK1_5
	if (arg.isCompatibleWith(param))
		return COMPATIBLE;
	if (tieBreakingVarargsMethods && (this.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_7 || !CompilerOptions.tolerateIllegalAmbiguousVarargsInvocation)) {
		/* 15.12.2.5 Choosing the Most Specific Method, ... One variable arity member method named m is more specific than
		   another variable arity member method of the same name if either ... Only subtypes relationship should be used.
		   Actually this is true even for fixed arity methods, but in practice is not an issue since we run the algorithm
		   multiple times for each compatibility level.
		   https://bugs.eclipse.org/bugs/show_bug.cgi?id=346038, https://bugs.eclipse.org/bugs/show_bug.cgi?id=346039.
		*/
		return NOT_COMPATIBLE;
	}
	if (arg.isBaseType() != param.isBaseType()) {
		TypeBinding convertedType = env.computeBoxingType(arg);
		if (convertedType == param || convertedType.isCompatibleWith(param))
			return AUTOBOX_COMPATIBLE;
	}
	return NOT_COMPATIBLE;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:20,代码来源:Scope.java

示例7: checkInheritedMethods

void checkInheritedMethods(MethodBinding inheritedMethod, MethodBinding otherInheritedMethod) {

	// the 2 inherited methods clash because of a parameterized type overrides a raw type
	//		interface I { void foo(A a); }
	//		class Y { void foo(A<String> a) {} }
	//		abstract class X extends Y implements I { }
	//		class A<T> {}
	// in this case the 2 inherited methods clash because of type variables
	//		interface I { <T, S> void foo(T t); }
	//		class Y { <T> void foo(T t) {} }
	//		abstract class X extends Y implements I {}

	if (inheritedMethod.isStatic()) return;
	if (this.environment.globalOptions.complianceLevel < ClassFileConstants.JDK1_7 && inheritedMethod.declaringClass.isInterface())
		return;  // JDK7 checks for name clashes in interface inheritance, while JDK6 and below don't. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=354229

	detectInheritedNameClash(inheritedMethod.original(), otherInheritedMethod.original());
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:MethodVerifier15.java

示例8: createCompilerOptions

/**
 * Create the default compiler options
 */
public static CompilerOptions createCompilerOptions() {
    CompilerOptions options = new CompilerOptions();

    // Always using JDK 7 rather than basing it on project metadata since we
    // don't do compilation error validation in lint (we leave that to the IDE's
    // error parser or the command line build's compilation step); we want an
    // AST that is as tolerant as possible.
    long languageLevel = ClassFileConstants.JDK1_7;
    options.complianceLevel = languageLevel;
    options.sourceLevel = languageLevel;
    options.targetJDK = languageLevel;
    options.originalComplianceLevel = languageLevel;
    options.originalSourceLevel = languageLevel;
    options.inlineJsrBytecode = true; // >1.5

    options.parseLiteralExpressionsAsConstants = true;
    options.analyseResourceLeaks = false;
    options.docCommentSupport = false;
    options.defaultEncoding = UTF_8;
    options.suppressOptionalErrors = true;
    options.generateClassFiles = false;
    options.isAnnotationBasedNullAnalysisEnabled = false;
    options.reportUnusedDeclaredThrownExceptionExemptExceptionAndThrowable = false;
    options.reportUnusedDeclaredThrownExceptionIncludeDocCommentReference = false;
    options.reportUnusedDeclaredThrownExceptionWhenOverriding = false;
    options.reportUnusedParameterIncludeDocCommentReference = false;
    options.reportUnusedParameterWhenImplementingAbstract = false;
    options.reportUnusedParameterWhenOverridingConcrete = false;
    options.suppressWarnings = true;
    options.processAnnotations = true;
    options.storeAnnotations = true;
    options.verbose = false;
    return options;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:EcjParser.java

示例9: versionFromJdkLevel

public static String versionFromJdkLevel(long jdkLevel) {
	switch ((int)(jdkLevel>>16)) {
		case ClassFileConstants.MAJOR_VERSION_1_1 :
			if (jdkLevel == ClassFileConstants.JDK1_1)
				return VERSION_1_1;
			break;
		case ClassFileConstants.MAJOR_VERSION_1_2 :
			if (jdkLevel == ClassFileConstants.JDK1_2)
				return VERSION_1_2;
			break;
		case ClassFileConstants.MAJOR_VERSION_1_3 :
			if (jdkLevel == ClassFileConstants.JDK1_3)
				return VERSION_1_3;
			break;
		case ClassFileConstants.MAJOR_VERSION_1_4 :
			if (jdkLevel == ClassFileConstants.JDK1_4)
				return VERSION_1_4;
			break;
		case ClassFileConstants.MAJOR_VERSION_1_5 :
			if (jdkLevel == ClassFileConstants.JDK1_5)
				return VERSION_1_5;
			break;
		case ClassFileConstants.MAJOR_VERSION_1_6 :
			if (jdkLevel == ClassFileConstants.JDK1_6)
				return VERSION_1_6;
			break;
		case ClassFileConstants.MAJOR_VERSION_1_7 :
			if (jdkLevel == ClassFileConstants.JDK1_7)
				return VERSION_1_7;
			break;
		case ClassFileConstants.MAJOR_VERSION_1_8 :
			if (jdkLevel == ClassFileConstants.JDK1_8)
				return VERSION_1_8;
			break;
	}
	return Util.EMPTY_STRING; // unknown version
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:37,代码来源:CompilerOptions.java

示例10: AST

/**
 * Creates a new, empty abstract syntax tree using the given options.
 * <p>
 * Following option keys are significant:
 * <ul>
 * <li><code>"org.eclipse.jdt.core.compiler.source"</code> -
 *    indicates source compatibility mode (as per <code>JavaCore</code>);
 *    <code>"1.3"</code> means the source code is as per JDK 1.3;
 *    <code>"1.4"</code> means the source code is as per JDK 1.4
 *    (<code>"assert"</code> is now a keyword);
 *    <code>"1.5"</code> means the source code is as per JDK 1.5
 *    (<code>"enum"</code> is now a keyword);
 *    <code>"1.7"</code> means the source code is as per JDK 1.7;
 *    additional legal values may be added later. </li>
 * </ul>
 * Options other than the above are ignored.
 * </p>
 *
 * @param options the table of options (key type: <code>String</code>;
 *    value type: <code>String</code>)
 * @see JavaCore#getDefaultOptions()
 * @deprecated Clients should port their code to use the new JLS4 AST API and call
 *    {@link #newAST(int) AST.newAST(AST.JLS4)} instead of using this constructor.
 */
public AST(Map options) {
	this(JLS2);
	Object sourceLevelOption = options.get(JavaCore.COMPILER_SOURCE);
	long sourceLevel = ClassFileConstants.JDK1_3;
	if (JavaCore.VERSION_1_4.equals(sourceLevelOption)) {
		sourceLevel = ClassFileConstants.JDK1_4;
	} else if (JavaCore.VERSION_1_5.equals(sourceLevelOption)) {
		sourceLevel = ClassFileConstants.JDK1_5;
	} else if (JavaCore.VERSION_1_7.equals(sourceLevelOption)) {
		sourceLevel = ClassFileConstants.JDK1_7;
	}
	Object complianceLevelOption = options.get(JavaCore.COMPILER_COMPLIANCE);
	long complianceLevel = ClassFileConstants.JDK1_3;
	if (JavaCore.VERSION_1_4.equals(complianceLevelOption)) {
		complianceLevel = ClassFileConstants.JDK1_4;
	} else if (JavaCore.VERSION_1_5.equals(complianceLevelOption)) {
		complianceLevel = ClassFileConstants.JDK1_5;
	} else if (JavaCore.VERSION_1_7.equals(complianceLevelOption)) {
		complianceLevel = ClassFileConstants.JDK1_7;
	}
	// override scanner if 1.4 or 1.5 asked for
	this.scanner = new Scanner(
		true /*comment*/,
		true /*whitespace*/,
		false /*nls*/,
		sourceLevel /*sourceLevel*/,
		complianceLevel /*complianceLevel*/,
		null/*taskTag*/,
		null/*taskPriorities*/,
		true/*taskCaseSensitive*/);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:55,代码来源:AST.java

示例11: versionToJdkLevel

public static long versionToJdkLevel(Object versionID) {
	if (versionID instanceof String) {
		String version = (String) versionID;
		// verification is optimized for all versions with same length and same "1." prefix
		if (version.length() == 3 && version.charAt(0) == '1' && version.charAt(1) == '.') {
			switch (version.charAt(2)) {
				case '1':
					return ClassFileConstants.JDK1_1;
				case '2':
					return ClassFileConstants.JDK1_2;
				case '3':
					return ClassFileConstants.JDK1_3;
				case '4':
					return ClassFileConstants.JDK1_4;
				case '5':
					return ClassFileConstants.JDK1_5;
				case '6':
					return ClassFileConstants.JDK1_6;
				case '7':
					return ClassFileConstants.JDK1_7;
				case '8':
					return ClassFileConstants.JDK1_8;
				default:
					return 0; // unknown
			}
		}
		if (VERSION_JSR14.equals(versionID)) {
			return ClassFileConstants.JDK1_4;
		}
		if (VERSION_CLDC1_1.equals(versionID)) {
			return ClassFileConstants.CLDC_1_1;
		}
	}
	return 0; // unknown
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:35,代码来源:CompilerOptions.java

示例12: incorrectSwitchType

public void incorrectSwitchType(Expression expression, TypeBinding testType) {
	if (this.options.sourceLevel < ClassFileConstants.JDK1_7) {
		if (testType.id == TypeIds.T_JavaLangString) {
			this.handle(
					IProblem.SwitchOnStringsNotBelow17,
					new String[] {new String(testType.readableName())},
					new String[] {new String(testType.shortReadableName())},
					expression.sourceStart,
					expression.sourceEnd);
		} else {
			if (this.options.sourceLevel < ClassFileConstants.JDK1_5 && testType.isEnum()) {
				this.handle(
						IProblem.SwitchOnEnumNotBelow15,
						new String[] {new String(testType.readableName())},
						new String[] {new String(testType.shortReadableName())},
						expression.sourceStart,
						expression.sourceEnd);
			} else {
				this.handle(
						IProblem.IncorrectSwitchType,
						new String[] {new String(testType.readableName())},
						new String[] {new String(testType.shortReadableName())},
						expression.sourceStart,
						expression.sourceEnd);
			}
		}
	} else {
		this.handle(
				IProblem.IncorrectSwitchType17,
				new String[] {new String(testType.readableName())},
				new String[] {new String(testType.shortReadableName())},
				expression.sourceStart,
				expression.sourceEnd);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:35,代码来源:ProblemReporter.java

示例13: versionToJdkLevel

public static long versionToJdkLevel(Object versionID) {
	if (versionID instanceof String) {
		String version = (String) versionID;
		// verification is optimized for all versions with same length and same "1." prefix
		if (version.length() == 3 && version.charAt(0) == '1' && version.charAt(1) == '.') {
			switch (version.charAt(2)) {
				case '1':
					return ClassFileConstants.JDK1_1;
				case '2':
					return ClassFileConstants.JDK1_2;
				case '3':
					return ClassFileConstants.JDK1_3;
				case '4':
					return ClassFileConstants.JDK1_4;
				case '5':
					return ClassFileConstants.JDK1_5;
				case '6':
					return ClassFileConstants.JDK1_6;
				case '7':
					return ClassFileConstants.JDK1_7;
				default:
					return 0; // unknown
			}
		}
		if (VERSION_JSR14.equals(versionID)) {
			return ClassFileConstants.JDK1_4;
		}
		if (VERSION_CLDC1_1.equals(versionID)) {
			return ClassFileConstants.CLDC_1_1;
		}
	}
	return 0; // unknown
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:33,代码来源:CompilerOptions.java

示例14: toJdtVersion

protected long toJdtVersion(final JavaVersion version) {
  try {
    long _switchResult = (long) 0;
    if (version != null) {
      switch (version) {
        case JAVA5:
          _switchResult = ClassFileConstants.JDK1_5;
          break;
        case JAVA6:
          _switchResult = ClassFileConstants.JDK1_6;
          break;
        case JAVA7:
          _switchResult = ClassFileConstants.JDK1_7;
          break;
        case JAVA8:
          long _xtrycatchfinallyexpression = (long) 0;
          try {
            _xtrycatchfinallyexpression = ClassFileConstants.class.getField("JDK1_8").getLong(null);
          } catch (final Throwable _t) {
            if (_t instanceof NoSuchFieldException) {
              _xtrycatchfinallyexpression = ClassFileConstants.JDK1_7;
            } else {
              throw Exceptions.sneakyThrow(_t);
            }
          }
          _switchResult = _xtrycatchfinallyexpression;
          break;
        case JAVA9:
          long _xtrycatchfinallyexpression_1 = (long) 0;
          try {
            _xtrycatchfinallyexpression_1 = ClassFileConstants.class.getField("JDK1_9").getLong(null);
          } catch (final Throwable _t_1) {
            if (_t_1 instanceof NoSuchFieldException) {
              _xtrycatchfinallyexpression_1 = ClassFileConstants.JDK1_7;
            } else {
              throw Exceptions.sneakyThrow(_t_1);
            }
          }
          _switchResult = _xtrycatchfinallyexpression_1;
          break;
        default:
          break;
      }
    }
    return _switchResult;
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:49,代码来源:JavaDerivedStateComputer.java

示例15: AST

/**
 * Creates a new Java abstract syntax tree
    * (AST) following the specified set of API rules.
    *
	 * @param level the API level; one of the <code>JLS*</code> level constants
    * @since 3.0
 */
private AST(int level) {
	switch(level) {
		case JLS2_INTERNAL :
		case JLS3_INTERNAL :
			this.apiLevel = level;
			// initialize a scanner
			this.scanner = new Scanner(
					true /*comment*/,
					true /*whitespace*/,
					false /*nls*/,
					ClassFileConstants.JDK1_3 /*sourceLevel*/,
					ClassFileConstants.JDK1_5 /*complianceLevel*/,
					null/*taskTag*/,
					null/*taskPriorities*/,
					true/*taskCaseSensitive*/);
			break;
		case JLS4_INTERNAL :
			this.apiLevel = level;
			// initialize a scanner
			this.scanner = new Scanner(
					true /*comment*/,
					true /*whitespace*/,
					false /*nls*/,
					ClassFileConstants.JDK1_7 /*sourceLevel*/,
					ClassFileConstants.JDK1_7 /*complianceLevel*/,
					null/*taskTag*/,
					null/*taskPriorities*/,
					true/*taskCaseSensitive*/);
			break;
		case JLS8 :
			this.apiLevel = level;
			// initialize a scanner
			this.scanner = new Scanner(
					true /*comment*/,
					true /*whitespace*/,
					false /*nls*/,
					ClassFileConstants.JDK1_8 /*sourceLevel*/,
					ClassFileConstants.JDK1_8 /*complianceLevel*/,
					null/*taskTag*/,
					null/*taskPriorities*/,
					true/*taskCaseSensitive*/);
			break;	
		default:
			throw new IllegalArgumentException("Unsupported JLS level"); //$NON-NLS-1$
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:53,代码来源:AST.java


注:本文中的org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.JDK1_7属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。