本文整理汇总了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();
}
}
示例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();
}
}
示例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");
}
示例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");
}
示例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");
}
示例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);
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例12: configureLocalInspectionTools
import com.intellij.codeInspection.dataFlow.DataFlowInspection; //导入依赖的package包/类
@NotNull
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
return new LocalInspectionTool[] {
new DataFlowInspection()
};
}
示例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");
}
示例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");
}
示例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");
}