• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ProblemReporter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.problem.ProblemReporter的典型用法代码示例。如果您正苦于以下问题:Java ProblemReporter类的具体用法?Java ProblemReporter怎么用?Java ProblemReporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ProblemReporter类属于org.eclipse.jdt.internal.compiler.problem包,在下文中一共展示了ProblemReporter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parse

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
@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,代码行数:27,代码来源:LombokPsiConverterTest.java


示例2: buildCompilationUnit

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
public static CompilationUnitDeclaration buildCompilationUnit(
    ISourceType[] sourceTypes,
    int flags,
    ProblemReporter problemReporter,
    CompilationResult compilationResult) {

  //		long start = System.currentTimeMillis();
  SourceTypeConverter converter = new SourceTypeConverter(flags, problemReporter);
  try {
    return converter.convert(sourceTypes, compilationResult);
  } catch (JavaModelException e) {
    return null;
    /*		} finally {
    			System.out.println("Spent " + (System.currentTimeMillis() - start) + "ms to convert " + ((JavaElement) converter.cu)
    			.toStringWithAncestors());
    */
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:SourceTypeConverter.java


示例3: process

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
@Override public ASTNode process(Source in, Void irrelevant) throws ConversionProblem {
	CompilerOptions compilerOptions = ecjCompilerOptions();
	Parser parser = new Parser(new ProblemReporter(
			DefaultErrorHandlingPolicies.proceedWithAllProblems(),
			compilerOptions,
			new DefaultProblemFactory()
		), compilerOptions.parseLiteralExpressionsAsConstants);
	parser.javadocParser.checkDocComment = true;
	CompilationUnit sourceUnit = new CompilationUnit(in.getRawInput().toCharArray(), in.getName(), charset.name());
	CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
	CompilationUnitDeclaration cud = parser.parse(sourceUnit, compilationResult);
	
	if (cud.hasErrors()) {
		throw new ConversionProblem(String.format("Can't read file %s due to parse error: %s", in.getName(), compilationResult.getErrors()[0]));
	}
	
	return cud;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:19,代码来源:Main.java


示例4: createDefaultProblemReporter

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
private static ProblemReporter createDefaultProblemReporter(CompilerOptions options) {
	return new ProblemReporter(new IErrorHandlingPolicy() {
		public boolean proceedOnErrors() {
			return true;
		}
		
		public boolean stopOnFirstError() {
			return false;
		}
		
		@Override
		public boolean ignoreAllErrors() {
			return false;
		}
	}, options, new DefaultProblemFactory(Locale.ENGLISH));
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:17,代码来源:EcjTreeBuilder.java


示例5: createSilentProblemReporter

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
private static ProblemReporter createSilentProblemReporter(CompilerOptions options) {
	return new ProblemReporter(new IErrorHandlingPolicy() {
		public boolean proceedOnErrors() {
			return true;
		}
		
		public boolean stopOnFirstError() {
			return false;
		}
		
		@Override
		public boolean ignoreAllErrors() {
			return false;
		}
	}, options, SILENT_PROBLEM_FACTORY);
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:17,代码来源:EcjTreeBuilder.java


示例6: parseWithLombok

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
@Override
protected ASTNode parseWithLombok(Source source) {
	CompilerOptions compilerOptions = ecjCompilerOptions();
	Parser parser = new Parser(new ProblemReporter(
			DefaultErrorHandlingPolicies.proceedWithAllProblems(),
			compilerOptions,
			new DefaultProblemFactory()
		), compilerOptions.parseLiteralExpressionsAsConstants);
	parser.javadocParser.checkDocComment = true;
	CompilationUnit sourceUnit = new CompilationUnit(source.getRawInput().toCharArray(), source.getName(), "UTF-8");
	CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
	CompilationUnitDeclaration cud = parser.parse(sourceUnit, compilationResult);
	
	if (cud.hasErrors()) return null;
	
	EcjTreeConverter converter = new EcjTreeConverter();
	converter.visit(source.getRawInput(), cud);
	Node lombokized = converter.get();
	
	EcjTreeBuilder builder = new EcjTreeBuilder(source.getRawInput(), source.getName(), ecjCompilerOptions());
	builder.visit(lombokized);
	return builder.get();
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:24,代码来源:EcjTreeConverterType2Test.java


示例7: parseWithTargetCompiler

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
@Override
protected ASTNode parseWithTargetCompiler(Source source) {
	CompilerOptions compilerOptions = ecjCompilerOptions();
	Parser parser = new Parser(new ProblemReporter(
			DefaultErrorHandlingPolicies.proceedWithAllProblems(),
			compilerOptions,
			new DefaultProblemFactory()
		), compilerOptions.parseLiteralExpressionsAsConstants);
	parser.javadocParser.checkDocComment = true;
	CompilationUnit sourceUnit = new CompilationUnit(source.getRawInput().toCharArray(), source.getName(), "UTF-8");
	CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
	CompilationUnitDeclaration cud = parser.parse(sourceUnit, compilationResult);
	
	if (cud.hasErrors()) return null;
	
	return cud;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:18,代码来源:EcjTreeConverterType2Test.java


示例8: parseWithTargetCompiler

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
@Override
protected ASTNode parseWithTargetCompiler(Source source) {
	CompilerOptions compilerOptions = ecjCompilerOptions();
	Parser parser = new Parser(new ProblemReporter(
			DefaultErrorHandlingPolicies.proceedWithAllProblems(),
			compilerOptions,
			new DefaultProblemFactory()
		), compilerOptions.parseLiteralExpressionsAsConstants);
	parser.javadocParser.checkDocComment = true;
	CompilationUnit sourceUnit = new CompilationUnit(source.getRawInput().toCharArray(), source.getName(), "UTF-8");
	CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
	CompilationUnitDeclaration cud = parser.parse(sourceUnit, compilationResult);
	
	if (cud.hasErrors()) return null;
	return cud;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:17,代码来源:EcjTreeBuilderTest.java


示例9: parseWithTargetCompiler

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
protected Node parseWithTargetCompiler(Source source) {
	CompilerOptions compilerOptions = ecjCompilerOptions();
	Parser parser = new Parser(new ProblemReporter(
			DefaultErrorHandlingPolicies.proceedWithAllProblems(),
			compilerOptions,
			new DefaultProblemFactory()
		), compilerOptions.parseLiteralExpressionsAsConstants);
	parser.javadocParser.checkDocComment = true;
	CompilationUnit sourceUnit = new CompilationUnit(source.getRawInput().toCharArray(), source.getName(), "UTF-8");
	CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
	CompilationUnitDeclaration cud = parser.parse(sourceUnit, compilationResult);
	
	if (cud.hasErrors()) return null;
	
	EcjTreeConverter converter = new EcjTreeConverter();
	converter.visit(source.getRawInput(), cud);
	return converter.get();
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:19,代码来源:EcjTreeConverterType1Test.java


示例10: buildCompilationUnit

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
public static CompilationUnitDeclaration buildCompilationUnit(
		ISourceType[] sourceTypes,
		int flags,
		ProblemReporter problemReporter,
		CompilationResult compilationResult) {

//		long start = System.currentTimeMillis();
		SourceTypeConverter converter = new SourceTypeConverter(flags, problemReporter);
		try {
			return converter.convert(sourceTypes, compilationResult);
		} catch (JavaModelException e) {
			return null;
/*		} finally {
			System.out.println("Spent " + (System.currentTimeMillis() - start) + "ms to convert " + ((JavaElement) converter.cu).toStringWithAncestors());
*/		}
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:SourceTypeConverter.java


示例11: Parser

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
public Parser(ProblemReporter problemReporter, boolean optimizeStringLiterals) {

	this.problemReporter = problemReporter;
	this.options = problemReporter.options;
	this.optimizeStringLiterals = optimizeStringLiterals;
	initializeScanner();
	this.parsingJava8Plus = this.options.sourceLevel >= ClassFileConstants.JDK1_8;
	this.astLengthStack = new int[50];
	this.expressionLengthStack = new int[30];
	this.typeAnnotationLengthStack = new int[30];
	this.intStack = new int[50];
	this.identifierStack = new char[30][];
	this.identifierLengthStack = new int[30];
	this.nestedMethod = new int[30];
	this.realBlockStack = new int[30];
	this.identifierPositionStack = new long[30];
	this.variablesCounter = new int[30];

	// javadoc support
	this.javadocParser = createJavadocParser();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:Parser.java


示例12: isSuppressed

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
public boolean isSuppressed(CategorizedProblem problem) {
	if (this.suppressWarningsCount == 0) return false;
	int irritant = ProblemReporter.getIrritant(problem.getID());
	if (irritant == 0) return false;
	int start = problem.getSourceStart();
	int end = problem.getSourceEnd();
	nextSuppress: for (int iSuppress = 0, suppressCount = this.suppressWarningsCount; iSuppress < suppressCount; iSuppress++) {
		long position = this.suppressWarningScopePositions[iSuppress];
		int startSuppress = (int) (position >>> 32);
		int endSuppress = (int) position;
		if (start < startSuppress) continue nextSuppress;
		if (end > endSuppress) continue nextSuppress;
		if (this.suppressWarningIrritants[iSuppress].isSet(irritant))
			return true;
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:CompilationUnitDeclaration.java


示例13: LookupEnvironment

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
public LookupEnvironment(ITypeRequestor typeRequestor, CompilerOptions globalOptions, ProblemReporter problemReporter, INameEnvironment nameEnvironment) {
	this.typeRequestor = typeRequestor;
	this.globalOptions = globalOptions;
	this.problemReporter = problemReporter;
	this.defaultPackage = new PackageBinding(this); // assume the default package always exists
	this.defaultImports = null;
	this.nameEnvironment = nameEnvironment;
	this.knownPackages = new HashtableOfPackage();
	this.uniqueParameterizedGenericMethodBindings = new SimpleLookupTable(3);
	this.uniquePolymorphicMethodBindings = new SimpleLookupTable(3);
	this.missingTypes = null;
	this.accessRestrictions = new HashMap(3);
	this.classFilePool = ClassFilePool.newInstance();
	this.typesBeingConnected = new HashSet();
	this.typeSystem = this.globalOptions.sourceLevel >= ClassFileConstants.JDK1_8 && this.globalOptions.storeAnnotations ? new AnnotatableTypeSystem(this) : new TypeSystem(this);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:LookupEnvironment.java


示例14: Parser

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
public Parser(ProblemReporter problemReporter, boolean optimizeStringLiterals) {

	this.problemReporter = problemReporter;
	this.options = problemReporter.options;
	this.optimizeStringLiterals = optimizeStringLiterals;
	initializeScanner();
	this.astLengthStack = new int[50];
	this.expressionLengthStack = new int[30];
	this.intStack = new int[50];
	this.identifierStack = new char[30][];
	this.identifierLengthStack = new int[30];
	this.nestedMethod = new int[30];
	this.realBlockStack = new int[30];
	this.identifierPositionStack = new long[30];
	this.variablesCounter = new int[30];

	// javadoc support
	this.javadocParser = createJavadocParser();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:20,代码来源:Parser.java


示例15: LookupEnvironment

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
public LookupEnvironment(ITypeRequestor typeRequestor, CompilerOptions globalOptions, ProblemReporter problemReporter, INameEnvironment nameEnvironment) {
	this.typeRequestor = typeRequestor;
	this.globalOptions = globalOptions;
	this.problemReporter = problemReporter;
	this.defaultPackage = new PackageBinding(this); // assume the default package always exists
	this.defaultImports = null;
	this.nameEnvironment = nameEnvironment;
	this.knownPackages = new HashtableOfPackage();
	this.uniqueArrayBindings = new ArrayBinding[5][];
	this.uniqueArrayBindings[0] = new ArrayBinding[50]; // start off the most common 1 dimension array @ 50
	this.uniqueParameterizedTypeBindings = new SimpleLookupTable(3);
	this.uniqueRawTypeBindings = new SimpleLookupTable(3);
	this.uniqueWildcardBindings = new SimpleLookupTable(3);
	this.uniqueParameterizedGenericMethodBindings = new SimpleLookupTable(3);
	this.uniquePolymorphicMethodBindings = new SimpleLookupTable(3);
	this.missingTypes = null;
	this.accessRestrictions = new HashMap(3);
	this.classFilePool = ClassFilePool.newInstance();
	this.typesBeingConnected = new HashSet();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:21,代码来源:LookupEnvironment.java


示例16: installStubs

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
public void installStubs(final Resource resource) {
  boolean _isInfoFile = this.isInfoFile(resource);
  if (_isInfoFile) {
    return;
  }
  final CompilationUnit compilationUnit = this.getCompilationUnit(resource);
  IErrorHandlingPolicy _proceedWithAllProblems = DefaultErrorHandlingPolicies.proceedWithAllProblems();
  CompilerOptions _compilerOptions = this.getCompilerOptions(resource);
  DefaultProblemFactory _defaultProblemFactory = new DefaultProblemFactory();
  ProblemReporter _problemReporter = new ProblemReporter(_proceedWithAllProblems, _compilerOptions, _defaultProblemFactory);
  final Parser parser = new Parser(_problemReporter, true);
  final CompilationResult compilationResult = new CompilationResult(compilationUnit, 0, 1, (-1));
  final CompilationUnitDeclaration result = parser.dietParse(compilationUnit, compilationResult);
  if ((result.types != null)) {
    for (final TypeDeclaration type : result.types) {
      {
        ImportReference _currentPackage = result.currentPackage;
        char[][] _importName = null;
        if (_currentPackage!=null) {
          _importName=_currentPackage.getImportName();
        }
        List<String> _map = null;
        if (((List<char[]>)Conversions.doWrapArray(_importName))!=null) {
          final Function1<char[], String> _function = (char[] it) -> {
            return String.valueOf(it);
          };
          _map=ListExtensions.<char[], String>map(((List<char[]>)Conversions.doWrapArray(_importName)), _function);
        }
        String _join = null;
        if (_map!=null) {
          _join=IterableExtensions.join(_map, ".");
        }
        final String packageName = _join;
        final JvmDeclaredType jvmType = this.createType(type, packageName);
        resource.getContents().add(jvmType);
      }
    }
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:40,代码来源:JavaDerivedStateComputer.java


示例17: getMethod

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
private static Method getMethod(String name, Class<?>... types) {
	try {
		Method m = ProblemReporter.class.getMethod(name, types);
		m.setAccessible(true);
		return m;
	} catch (Exception e) {
		return null;
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:10,代码来源:PatchExtensionMethod.java


示例18: EcjTreeBuilder

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
public EcjTreeBuilder(lombok.ast.grammar.Source source, ProblemReporter reporter, ProblemReporter silentProblemReporter, CompilationResult compilationResult) {
	this.options = reporter.options;
	this.sourceStructures = source.getSourceStructures();
	this.rawInput = source.getRawInput();
	this.reporter = reporter;
	this.silentProblemReporter = silentProblemReporter;
	this.compilationResult = compilationResult;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:9,代码来源:EcjTreeBuilder.java


示例19: parseWithEcj

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
private void parseWithEcj(Source source) {
	if (VERBOSE) {
		CompilerOptions compilerOptions = ecjCompilerOptions();
		Parser parser = new Parser(new ProblemReporter(
				DefaultErrorHandlingPolicies.proceedWithAllProblems(),
				compilerOptions,
				new DefaultProblemFactory()
			), compilerOptions.parseLiteralExpressionsAsConstants);
		parser.javadocParser.checkDocComment = true;
		CompilationUnit sourceUnit = new CompilationUnit(source.getRawInput().toCharArray(), source.getName(), "UTF-8");
		CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
		parser.parse(sourceUnit, compilationResult);
	}
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:15,代码来源:PerformanceTest.java


示例20: CompletionEngine

import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; //导入依赖的package包/类
/**
 * The CompletionEngine is responsible for computing source completions.
 *
 * It requires a searchable name environment, which supports some
 * specific search APIs, and a requestor to feed back the results to a UI.
 *
 *  @param nameEnvironment org.eclipse.jdt.internal.codeassist.ISearchableNameEnvironment
 *      used to resolve type/package references and search for types/packages
 *      based on partial names.
 *
 *  @param requestor org.eclipse.jdt.internal.codeassist.ICompletionRequestor
 *      since the engine might produce answers of various forms, the engine
 *      is associated with a requestor able to accept all possible completions.
 *
 *  @param settings java.util.Map
 *		set of options used to configure the code assist engine.
 */
public CompletionEngine(
		SearchableEnvironment nameEnvironment,
		CompletionRequestor requestor,
		Map settings,
		IJavaProject javaProject,
		WorkingCopyOwner owner,
		IProgressMonitor monitor) {
	super(settings);
	this.javaProject = javaProject;
	this.requestor = requestor;
	this.nameEnvironment = nameEnvironment;
	this.typeCache = new HashtableOfObject(5);
	this.openedBinaryTypes = 0;
	this.sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
	this.complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);

	this.problemFactory = new CompletionProblemFactory(Locale.getDefault());
	this.problemReporter = new ProblemReporter(
			DefaultErrorHandlingPolicies.proceedWithAllProblems(),
			this.compilerOptions,
			this.problemFactory);
	this.lookupEnvironment =
		new LookupEnvironment(this, this.compilerOptions, this.problemReporter, nameEnvironment);
	this.parser =
		new CompletionParser(this.problemReporter, this.requestor.isExtendedContextRequired(), monitor);
	this.owner = owner;
	this.monitor = monitor;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:46,代码来源:CompletionEngine.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OFPortConfigSerializerVer12类代码示例发布时间:2022-05-22
下一篇:
Java XExpression类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap