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


Java DataFlowInspection类代码示例

本文整理汇总了Java中com.intellij.codeInspection.dataFlow.DataFlowInspection的典型用法代码示例。如果您正苦于以下问题:Java DataFlowInspection类的具体用法?Java DataFlowInspection怎么用?Java DataFlowInspection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testDoNotInstantiateOnSave

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
public void testDoNotInstantiateOnSave() throws Exception {
  InspectionProfileImpl profile = new InspectionProfileImpl("profile", InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), InspectionProfileImpl.getDefaultProfile());
  assertEquals(0, countInitializedTools(profile));
  InspectionToolWrapper[] toolWrappers = profile.getInspectionTools(null);
  assertTrue(toolWrappers.length > 0);
  InspectionToolWrapper toolWrapper = profile.getInspectionTool(new DataFlowInspection().getShortName(), getProject());
  assertNotNull(toolWrapper);
  String id = toolWrapper.getShortName();
  System.out.println(id);
  if (profile.isToolEnabled(HighlightDisplayKey.findById(id))) {
    profile.disableTool(id, getProject());
  }
  else {
    profile.enableTool(id, getProject());
  }
  assertEquals(0, countInitializedTools(profile));
  profile.writeExternal(new Element("profile"));
  List<InspectionToolWrapper> initializedTools = getInitializedTools(profile);
  if (initializedTools.size() > 0) {
    for (InspectionToolWrapper initializedTool : initializedTools) {
      System.out.println(initializedTool.getShortName());
    }
    fail();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:InspectionProfileTest.java

示例2: testDoNotInstantiateOnSave

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
public void testDoNotInstantiateOnSave() throws Exception {
  InspectionProfileImpl profile = new InspectionProfileImpl("profile");
  profile.setBaseProfile(InspectionProfileImpl.getDefaultProfile());
  assertEquals(0, countInitializedTools(profile));
  InspectionToolWrapper[] toolWrappers = profile.getInspectionTools(null);
  assertTrue(toolWrappers.length > 0);
  InspectionToolWrapper toolWrapper = profile.getInspectionTool(new DataFlowInspection().getShortName(), getProject());
  assertNotNull(toolWrapper);
  String id = toolWrapper.getShortName();
  System.out.println(id);
  if (profile.isToolEnabled(HighlightDisplayKey.findById(id))) {
    profile.disableTool(id, getProject());
  }
  else {
    profile.enableTool(id, getProject());
  }
  assertEquals(0, countInitializedTools(profile));
  profile.writeExternal(new Element("profile"));
  List<InspectionToolWrapper> initializedTools = getInitializedTools(profile);
  if (initializedTools.size() != 1) {
    for (InspectionToolWrapper initializedTool : initializedTools) {
      System.out.println(initializedTool.getShortName());
    }
    fail();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:InspectionProfileTest.java

示例3: doTest

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
private void doTest() {
  final DataFlowInspection inspection = new DataFlowInspection();
  inspection.SUGGEST_NULLABLE_ANNOTATIONS = true;
  inspection.REPORT_CONSTANT_REFERENCE_VALUES = false;
  myFixture.enableInspections(inspection);
  myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:DataFlowInspectionTest.java

示例4: testFinalFieldNotDuringInitialization

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
public void testFinalFieldNotDuringInitialization() {
  final DataFlowInspection inspection = new DataFlowInspection();
  inspection.TREAT_UNKNOWN_MEMBERS_AS_NULLABLE = true;
  inspection.REPORT_CONSTANT_REFERENCE_VALUES = false;
  myFixture.enableInspections(inspection);
  myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:DataFlowInspectionTest.java

示例5: testCustomTypeQualifierDefault

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
public void testCustomTypeQualifierDefault() {
  addJavaxNullabilityAnnotations(myFixture);
  myFixture.addClass("package bar;" +
                     "@javax.annotation.meta.TypeQualifierDefault(java.lang.annotation.ElementType.METHOD) @javax.annotation.Nonnull " +
                     "public @interface MethodsAreNotNullByDefault {}");

  myFixture.addClass("package foo; public class AnotherPackageNotNull { public static native Object foo(String s); }");
  myFixture.addFileToProject("foo/package-info.java", "@bar.MethodsAreNotNullByDefault package foo;");

  myFixture.enableInspections(new DataFlowInspection());
  myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:DataFlowInspectionTest.java

示例6: testCustomDefaultInEnums

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
public void testCustomDefaultInEnums() {
  DataFlowInspectionTest.addJavaxNullabilityAnnotations(myFixture);
  myFixture.addClass("package foo;" +
                     "import static java.lang.annotation.ElementType.*;" +
                     "@javax.annotation.meta.TypeQualifierDefault({PARAMETER, FIELD, METHOD, LOCAL_VARIABLE}) " +
                     "@javax.annotation.Nonnull " +
                     "public @interface NonnullByDefault {}");

  myFixture.addFileToProject("foo/package-info.java", "@NonnullByDefault package foo;");

  myFixture.configureFromExistingVirtualFile(myFixture.copyFileToProject(getTestName(false) + ".java", "foo/Classes.java"));
  myFixture.enableInspections(new DataFlowInspection());
  myFixture.checkHighlighting(true, false, true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:DataFlowInspectionTest.java

示例7: testAssertThat

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
public void testAssertThat() {
  myFixture.addClass("package org.hamcrest; public class CoreMatchers { " +
                     "public static <T> Matcher<T> notNullValue() {}\n" +
                     "public static <T> Matcher<T> not(Matcher<T> matcher) {}\n" +
                     "public static <T> Matcher<T> equalTo(T operand) {}\n" +
                     "}");
  myFixture.addClass("package org.hamcrest; public interface Matcher<T> {}");
  myFixture.addClass("package org.junit; public class Assert { " +
                     "public static <T> void assertThat(T actual, org.hamcrest.Matcher<? super T> matcher) {}\n" +
                     "public static <T> void assertThat(String msg, T actual, org.hamcrest.Matcher<? super T> matcher) {}\n" +
                     "}");
  myFixture.enableInspections(new DataFlowInspection());
  myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:DataFlowInspectionTest.java

示例8: testGoogleTruth

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
public void testGoogleTruth() {
  myFixture.addClass("package com.google.common.truth; public class Truth { " +
                     "public static Subject assertThat(Object o) {}\n" +
                     "}");
  myFixture.addClass("package com.google.common.truth; public class Subject { public void isNotNull() {} }");
  myFixture.enableInspections(new DataFlowInspection());
  myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DataFlowInspectionTest.java

示例9: testBooleanPreconditions

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
public void testBooleanPreconditions() {
  myFixture.addClass("package com.google.common.base; public class Preconditions { " +
                     "public static <T> T checkArgument(boolean b) {}\n" +
                     "public static <T> T checkArgument(boolean b, String msg) {}\n" +
                     "public static <T> T checkState(boolean b, String msg) {}\n" +
                     "}");
  myFixture.enableInspections(new DataFlowInspection());
  myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:DataFlowInspectionTest.java

示例10: testGuavaCheckNotNull

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
public void testGuavaCheckNotNull() {
  myFixture.addClass("package com.google.common.base; public class Preconditions { " +
                     "public static <T> T checkNotNull(T reference) {}\n" +
                     "}");
  myFixture.enableInspections(new DataFlowInspection());
  myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:DataFlowInspectionTest.java

示例11: testNullableArrayComponent

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
public void testNullableArrayComponent() {
  setupCustomAnnotations();
  final DataFlowInspection inspection = new DataFlowInspection();
  inspection.IGNORE_ASSERT_STATEMENTS = true;
  myFixture.enableInspections(inspection);
  myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:DataFlowInspection8Test.java

示例12: configureLocalInspectionTools

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
@NotNull
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
  return new LocalInspectionTool[] {
    new DataFlowInspection()
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:FixAllQuickfixTest.java

示例13: testSkipAssertions

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
public void testSkipAssertions() {
  final DataFlowInspection inspection = new DataFlowInspection();
  inspection.DONT_REPORT_TRUE_ASSERT_STATEMENTS = true;
  myFixture.enableInspections(inspection);
  myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:DataFlowInspectionTest.java

示例14: testParanoidMode

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
public void testParanoidMode() {
  final DataFlowInspection inspection = new DataFlowInspection();
  inspection.TREAT_UNKNOWN_MEMBERS_AS_NULLABLE = true;
  myFixture.enableInspections(inspection);
  myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:DataFlowInspectionTest.java

示例15: doTestReportConstantReferences

import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
private void doTestReportConstantReferences() {
  DataFlowInspection inspection = new DataFlowInspection();
  inspection.SUGGEST_NULLABLE_ANNOTATIONS = true;
  myFixture.enableInspections(inspection);
  myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:DataFlowInspectionTest.java


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