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


Java ClassFileConstants.JDK1_5属性代码示例

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


在下文中一共展示了ClassFileConstants.JDK1_5属性的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: filterEnum

private boolean filterEnum(SearchMatch match) {
	
	// filter org.apache.commons.lang.enum package for projects above 1.5 
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317264	
	IJavaElement element = (IJavaElement)match.getElement();
	PackageFragment pkg = (PackageFragment)element.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
	if (pkg != null) {
		// enum was found in org.apache.commons.lang.enum at index 5
		if (pkg.names.length == 5 && pkg.names[4].equals("enum")) {  //$NON-NLS-1$
			if (this.options == null) {
				IJavaProject proj = (IJavaProject)pkg.getAncestor(IJavaElement.JAVA_PROJECT);
				String complianceStr = proj.getOption(CompilerOptions.OPTION_Source, true);
				if (CompilerOptions.versionToJdkLevel(complianceStr) >= ClassFileConstants.JDK1_5)
					return true;
			} else if (this.options.sourceLevel >= ClassFileConstants.JDK1_5) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:MatchLocator.java

示例3: invokeStringConcatenationToString

public void invokeStringConcatenationToString() {
	// invokespecial: java.lang.StringBuffer.toString()java.lang.String
	// or invokespecial: java.lang.StringBuilder.toString()java.lang.String
	char[] declaringClass;
	if (this.targetLevel < ClassFileConstants.JDK1_5) {
		// invokespecial: java.lang.StringBuffer.<init>()V
		declaringClass = ConstantPool.JavaLangStringBufferConstantPoolName;
	} else {
		// invokespecial: java.lang.StringStringBuilder.<init>(java.langString)V
		declaringClass = ConstantPool.JavaLangStringBuilderConstantPoolName;
	}	
	invoke(
			Opcodes.OPC_invokevirtual,
			1, // receiverAndArgsSize
			1, // return type size
			declaringClass,
			ConstantPool.ToString,
			ConstantPool.ToStringSignature);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:19,代码来源:CodeStream.java

示例4: 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,代码行数:18,代码来源:DocCommentParser.java

示例5: invokeStringConcatenationDefaultConstructor

public void invokeStringConcatenationDefaultConstructor() {
	// invokespecial: java.lang.StringBuffer.<init>()V
	// or invokespecial: java.lang.StringBuilder.<init>()V
	char[] declaringClass;
	if (this.targetLevel < ClassFileConstants.JDK1_5) {
		declaringClass = ConstantPool.JavaLangStringBufferConstantPoolName;
	} else {
		declaringClass = ConstantPool.JavaLangStringBuilderConstantPoolName;
	}
	invoke(
			Opcodes.OPC_invokespecial,
			1, // receiverAndArgsSize
			0, // return type size
			declaringClass,
			ConstantPool.Init,
			ConstantPool.DefaultConstructorSignature);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:CodeStream.java

示例6: consumePackageComment

protected void consumePackageComment() {
	// get possible comment for syntax since 1.5
	if(this.options.sourceLevel >= ClassFileConstants.JDK1_5) {
		checkComment();
		resetModifiers();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:7,代码来源:Parser.java

示例7: resolve

public void resolve(ClassScope upperScope) {

		if (this.binding == null) {
			this.ignoreFurtherInvestigation = true;
		}

		try {
			bindArguments();
			resolveReceiver();
			bindThrownExceptions();
			resolveJavadoc();
			resolveAnnotations(this.scope, this.annotations, this.binding);
			
			long sourceLevel = this.scope.compilerOptions().sourceLevel;
			validateNullAnnotations(sourceLevel);

			resolveStatements();
			// check @Deprecated annotation presence
			if (this.binding != null
					&& (this.binding.getAnnotationTagBits() & TagBits.AnnotationDeprecated) == 0
					&& (this.binding.modifiers & ClassFileConstants.AccDeprecated) != 0
					&& sourceLevel >= ClassFileConstants.JDK1_5) {
				this.scope.problemReporter().missingDeprecatedAnnotationForMethod(this);
			}
		} catch (AbortMethod e) {
			// ========= abort on fatal error =============
			this.ignoreFurtherInvestigation = true;
		}
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:AbstractMethodDeclaration.java

示例8: consumeNormalAnnotation

protected void consumeNormalAnnotation(boolean isTypeAnnotation) {
	if (this.topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BETWEEN_ANNOTATION_NAME_AND_RPAREN &&
			(this.topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER) & ANNOTATION_NAME_COMPLETION) != 0 ) {
		popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN);
		this.restartRecovery = true;
	} else {
		popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN);
		if (this.expressionPtr >= 0 && this.expressionStack[this.expressionPtr] instanceof CompletionOnMarkerAnnotationName) {
			Annotation annotation = (Annotation)this.expressionStack[this.expressionPtr];
			if(this.currentElement != null) {
				annotationRecoveryCheckPoint(annotation.sourceStart, annotation.declarationSourceEnd);
				if (this.currentElement instanceof RecoveredAnnotation) {
					this.currentElement = ((RecoveredAnnotation)this.currentElement).addAnnotation(annotation, this.identifierPtr);
				}
			}

			if(!this.statementRecoveryActivated &&
					this.options.sourceLevel < ClassFileConstants.JDK1_5 &&
					this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
				problemReporter().invalidUsageOfAnnotation(annotation);
			}
			this.recordStringLiterals = true;
			return;
		}
		super.consumeNormalAnnotation(isTypeAnnotation);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:CompletionParser.java

示例9: addFieldInfo

/**
 * INTERNAL USE-ONLY
 * This methods generates the bytes for the given field binding
 * @param fieldBinding the given field binding
 */
private void addFieldInfo(FieldBinding fieldBinding) {
	// check that there is enough space to write all the bytes for the field info corresponding
	// to the @fieldBinding
	if (this.contentsOffset + 8 >= this.contents.length) {
		resizeContents(8);
	}
	// Now we can generate all entries into the byte array
	// First the accessFlags
	int accessFlags = fieldBinding.getAccessFlags();
	if (this.targetJDK < ClassFileConstants.JDK1_5) {
		// pre 1.5, synthetic was an attribute, not a modifier
		accessFlags &= ~ClassFileConstants.AccSynthetic;
	}
	this.contents[this.contentsOffset++] = (byte) (accessFlags >> 8);
	this.contents[this.contentsOffset++] = (byte) accessFlags;
	// Then the nameIndex
	int nameIndex = this.constantPool.literalIndex(fieldBinding.name);
	this.contents[this.contentsOffset++] = (byte) (nameIndex >> 8);
	this.contents[this.contentsOffset++] = (byte) nameIndex;
	// Then the descriptorIndex
	int descriptorIndex = this.constantPool.literalIndex(fieldBinding.type);
	this.contents[this.contentsOffset++] = (byte) (descriptorIndex >> 8);
	this.contents[this.contentsOffset++] = (byte) descriptorIndex;
	int fieldAttributeOffset = this.contentsOffset;
	int attributeNumber = 0;
	// leave some space for the number of attributes
	this.contentsOffset += 2;
	attributeNumber += addFieldAttributes(fieldBinding, fieldAttributeOffset);
	if (this.contentsOffset + 2 >= this.contents.length) {
		resizeContents(2);
	}
	this.contents[fieldAttributeOffset++] = (byte) (attributeNumber >> 8);
	this.contents[fieldAttributeOffset] = (byte) attributeNumber;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:39,代码来源:ClassFile.java

示例10: analyseCode

public FlowInfo analyseCode(
	BlockScope currentScope,
	FlowContext flowContext,
	FlowInfo flowInfo) {

	// if reachable, request the addition of a synthetic field for caching the class descriptor
	SourceTypeBinding sourceType = currentScope.outerMostClassScope().enclosingSourceType();
	// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=22334
	if (!sourceType.isInterface()
			&& !this.targetType.isBaseType()
			&& currentScope.compilerOptions().targetJDK < ClassFileConstants.JDK1_5) {
		this.syntheticField = sourceType.addSyntheticFieldForClassLiteral(this.targetType, currentScope);
	}
	return flowInfo;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:15,代码来源:ClassLiteralAccess.java

示例11: buildLocalTypeBinding

void buildLocalTypeBinding(SourceTypeBinding enclosingType) {

		LocalTypeBinding localType = buildLocalType(enclosingType, enclosingType.fPackage);
		connectTypeHierarchy();
		if (compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) {
			checkParameterizedTypeBounds();
			checkParameterizedSuperTypeCollisions();
		}
		buildFieldsAndMethods();
		localType.faultInTypesForFieldsAndMethods();

		this.referenceContext.binding.verifyMethods(environment().methodVerifier());
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:ClassScope.java

示例12: areReturnTypesCompatible

boolean areReturnTypesCompatible(MethodBinding one, MethodBinding two) {
	if (one.returnType == two.returnType) return true;
	if (this.type.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) {
		return areReturnTypesCompatible0(one, two);
	} else {
		return areTypesEqual(one.returnType.erasure(), two.returnType.erasure());
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:8,代码来源:MethodVerifier15.java

示例13: finalVariableBound

public void finalVariableBound(TypeVariableBinding typeVariable, TypeReference typeRef) {
	if (this.options.sourceLevel < ClassFileConstants.JDK1_5) return;
	int severity = computeSeverity(IProblem.FinalBoundForTypeVariable);
	if (severity == ProblemSeverities.Ignore) return;
	this.handle(
		IProblem.FinalBoundForTypeVariable,
		new String[] { new String(typeVariable.sourceName()), new String(typeRef.resolvedType.readableName())},
		new String[] { new String(typeVariable.sourceName()), new String(typeRef.resolvedType.shortReadableName())},
		severity,
		typeRef.sourceStart,
		typeRef.sourceEnd);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:ProblemReporter.java

示例14: 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

示例15: 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


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