Summary: Kill these tests as that mode is not supported anymore. Note that : - "buck_cross_module" was effectively already dead since it's not hooked up to `make test` - "buck" is actually another copy of "genrule" so wasn't testing anything Reviewed By: ngorogiannis Differential Revision: D19176166 fbshipit-source-id: b5bb90448master
parent
e4dd2bbd8c
commit
cc0a4e807a
@ -1,9 +0,0 @@
|
||||
[buildfile]
|
||||
includes = //DEFS
|
||||
|
||||
[project]
|
||||
ignore = .git, .ml, .mli
|
||||
|
||||
[java]
|
||||
source_level = 8
|
||||
target_level = 8
|
@ -1 +0,0 @@
|
||||
../../../../.buckversion
|
@ -1,52 +0,0 @@
|
||||
import os
|
||||
|
||||
original_java_library = java_library
|
||||
def java_library(
|
||||
name,
|
||||
srcs=[],
|
||||
**kwargs
|
||||
):
|
||||
|
||||
original_java_library(
|
||||
name=name,
|
||||
srcs=srcs,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
create_infer_genrule(name, srcs)
|
||||
|
||||
original_android_library = android_library
|
||||
def android_library(
|
||||
name,
|
||||
srcs=[],
|
||||
**kwargs
|
||||
):
|
||||
|
||||
original_android_library(
|
||||
name=name,
|
||||
srcs=srcs,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
create_infer_genrule(name, srcs)
|
||||
|
||||
def create_infer_genrule(
|
||||
name,
|
||||
srcs
|
||||
):
|
||||
genrule_name = name + '_infer'
|
||||
genrule(
|
||||
name = genrule_name,
|
||||
srcs=srcs,
|
||||
cmd = ' '.join([
|
||||
os.getenv('INFER_BIN', 'infer'),
|
||||
'--genrule-mode',
|
||||
'--project-root', os.getenv('PROJECT_ROOT', os.environ['PWD']),
|
||||
'--eradicate-only',
|
||||
'--results-dir', '$OUT',
|
||||
'--classpath', '$(classpath :{})'.format(name),
|
||||
'--sourcepath', '$SRCDIR',
|
||||
'--generated-classes', '$(location :{})'.format(name),
|
||||
]),
|
||||
out = 'infer_out',
|
||||
)
|
@ -1,22 +0,0 @@
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
TESTS_DIR = ../..
|
||||
|
||||
BUCK_TARGET = //module2:module2
|
||||
INFER_OPTIONS = --eradicate --no-linters --buck-java-deprecated
|
||||
INFERPRINT_OPTIONS = --issues-tests
|
||||
CLEAN_EXTRA = buck-out
|
||||
SOURCES = $(shell find . -name '*.java')
|
||||
|
||||
include $(TESTS_DIR)/java.make
|
||||
include $(TESTS_DIR)/infer.make
|
||||
|
||||
infer-out/report.json: $(JAVA_DEPS) $(SOURCES)
|
||||
$(QUIET)$(REMOVE_DIR) buck-out && \
|
||||
$(call silent_on_success,Testing Buck Java integration,\
|
||||
INFER_BIN=$(INFER_BIN) \
|
||||
$(INFER_BIN) $(INFER_OPTIONS) --results-dir $(CURDIR)/infer-out -- \
|
||||
$(BUCK) build --deep --no-cache $(BUCK_TARGET))
|
@ -1,7 +0,0 @@
|
||||
java_library(
|
||||
name='annotations',
|
||||
srcs=['Nullable.java'],
|
||||
visibility=[
|
||||
'PUBLIC'
|
||||
],
|
||||
)
|
@ -1,9 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
package genrule.annotations;
|
||||
|
||||
public @interface Nullable {}
|
@ -1,22 +0,0 @@
|
||||
module1/Class1.java, genrule.module1.Class1.localNPE1():void, 1, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [NullPointerException will be thrown at this line! `obj` is `null` and is dereferenced via calling `toString()`: null constant at line 24]
|
||||
module1/Class1.java, genrule.module1.Class1.localNPE1():void, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure localNPE1()]
|
||||
module1/Class1.java, genrule.module1.Class1.unannotatedReturnNull():java.lang.Object, 0, ERADICATE_RETURN_NOT_NULLABLE, no_bucket, WARNING, [`unannotatedReturnNull()`: return type is declared non-nullable but the method returns `null`: null constant at line 33.]
|
||||
module2/Class2.java, genrule.module2.Class2$Sub.subtypingInconsistency(java.lang.Object):java.lang.Object, 0, ERADICATE_INCONSISTENT_SUBCLASS_PARAMETER_ANNOTATION, no_bucket, WARNING, [First parameter `object` of method `Class2$Sub.subtypingInconsistency(...)` is not `@Nullable` but is declared `@Nullable`in the parent class method `Class1$Sub.subtypingInconsistency(...)`.]
|
||||
module2/Class2.java, genrule.module2.Class2$Sub.subtypingInconsistency(java.lang.Object):java.lang.Object, 0, ERADICATE_INCONSISTENT_SUBCLASS_RETURN_ANNOTATION, no_bucket, WARNING, [Method `Class2$Sub.subtypingInconsistency(...)` is annotated with `@Nullable` but overrides unannotated method `Class1$Sub.subtypingInconsistency(...)`.]
|
||||
module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField1Bad(genrule.module1.Class1):void, 0, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [`class1.field1` is nullable and is not locally checked for null when calling `toString()`.]
|
||||
module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField1Bad(genrule.module1.Class1):void, 0, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure dereferenceInterTargetField1Bad(...)]
|
||||
module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField2Bad(genrule.module1.Class1):int, 0, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [`class1.field2` is nullable and is not locally checked for null when accessing field `Class1.x`.]
|
||||
module2/Class2.java, genrule.module2.Class2.dereferenceInterTargetField2Bad(genrule.module1.Class1):int, 0, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure dereferenceInterTargetField2Bad(...)]
|
||||
module2/Class2.java, genrule.module2.Class2.dereferenceLocalNullableFieldBad():void, 0, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [`Class2.field` is nullable and is not locally checked for null when calling `toString()`.]
|
||||
module2/Class2.java, genrule.module2.Class2.dereferenceLocalNullableFieldBad():void, 0, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure dereferenceLocalNullableFieldBad()]
|
||||
module2/Class2.java, genrule.module2.Class2.dereferenceUnannotatedMethodReturningNullBad(genrule.module1.Class1):void, 0, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure dereferenceUnannotatedMethodReturningNullBad(...),start of procedure unannotatedReturnNull(),return from a call to Object Class1.unannotatedReturnNull()]
|
||||
module2/Class2.java, genrule.module2.Class2.followMethodDeclarationOnlyBad(genrule.module1.SkipImplementationClass1):void, 1, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [`obj2` is nullable and is not locally checked for null when calling `toString()`: call to annotatedNullable() at line 39]
|
||||
module2/Class2.java, genrule.module2.Class2.followMethodDeclarationOnlyBad(genrule.module1.SkipImplementationClass1):void, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure followMethodDeclarationOnlyBad(...)]
|
||||
module2/Class2.java, genrule.module2.Class2.interTargetAbstractNPEBad(genrule.module1.Class1):void, 1, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [`obj` is nullable and is not locally checked for null when calling `toString()`: call to abstractMayReturnNull() at line 29]
|
||||
module2/Class2.java, genrule.module2.Class2.interTargetAbstractNPEBad(genrule.module1.Class1):void, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure interTargetAbstractNPEBad(...)]
|
||||
module2/Class2.java, genrule.module2.Class2.interTargetNPEBad():void, 1, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [`obj` is nullable and is not locally checked for null when calling `toString()`: call to returnsNull() at line 24]
|
||||
module2/Class2.java, genrule.module2.Class2.interTargetNPEBad():void, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure interTargetNPEBad(),start of procedure returnsNull(),return from a call to String Class1.returnsNull()]
|
||||
module2/Class2.java, genrule.module2.Class2.interTargetNativeNPEBad(genrule.module1.Class1):void, 1, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [`obj` is nullable and is not locally checked for null when calling `toString()`: call to nativeMayReturnNull() at line 34]
|
||||
module2/Class2.java, genrule.module2.Class2.interTargetNativeNPEBad(genrule.module1.Class1):void, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure interTargetNativeNPEBad(...)]
|
||||
module2/Class2.java, genrule.module2.Class2.localNPE2Bad():void, 1, ERADICATE_NULLABLE_DEREFERENCE, no_bucket, WARNING, [NullPointerException will be thrown at this line! `obj` is `null` and is dereferenced via calling `toString()`: null constant at line 19]
|
||||
module2/Class2.java, genrule.module2.Class2.localNPE2Bad():void, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure localNPE2Bad()]
|
@ -1,10 +0,0 @@
|
||||
java_library(
|
||||
name='module1',
|
||||
srcs=glob(["*.java"]),
|
||||
deps=[
|
||||
'//annotations:annotations',
|
||||
],
|
||||
visibility=[
|
||||
'PUBLIC'
|
||||
],
|
||||
)
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package genrule.module1;
|
||||
|
||||
import genrule.annotations.Nullable;
|
||||
|
||||
public abstract class Class1 {
|
||||
|
||||
public @Nullable Object field1;
|
||||
|
||||
public int x;
|
||||
public @Nullable Class1 field2;
|
||||
|
||||
public static @Nullable String returnsNull() {
|
||||
return null;
|
||||
}
|
||||
|
||||
void localNPE1() {
|
||||
Object obj = null;
|
||||
obj.toString();
|
||||
}
|
||||
|
||||
public abstract @Nullable Object abstractMayReturnNull();
|
||||
|
||||
public native @Nullable Object nativeMayReturnNull();
|
||||
|
||||
public Object unannotatedReturnNull() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Sub {
|
||||
public Object subtypingInconsistency(@Nullable Object object) {
|
||||
return new Object();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// _SHOULD_SKIP_IMPLEMENTATION_
|
||||
|
||||
package genrule.module1;
|
||||
|
||||
import genrule.annotations.Nullable;
|
||||
|
||||
public class SkipImplementationClass1 {
|
||||
|
||||
public @Nullable Object annotatedNullable() {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
public Object notAnnotatedNullable() {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
java_library(
|
||||
name='module2',
|
||||
srcs=glob(["*.java"]),
|
||||
deps=[
|
||||
'//module1:module1',
|
||||
'//annotations:annotations',
|
||||
]
|
||||
)
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package genrule.module2;
|
||||
|
||||
import genrule.annotations.Nullable;
|
||||
import genrule.module1.Class1;
|
||||
import genrule.module1.SkipImplementationClass1;
|
||||
|
||||
public class Class2 {
|
||||
|
||||
@Nullable Object field;
|
||||
|
||||
void localNPE2Bad() {
|
||||
Object obj = null;
|
||||
obj.toString();
|
||||
}
|
||||
|
||||
void interTargetNPEBad() {
|
||||
Object obj = Class1.returnsNull();
|
||||
obj.toString();
|
||||
}
|
||||
|
||||
void interTargetAbstractNPEBad(Class1 class1) {
|
||||
Object obj = class1.abstractMayReturnNull();
|
||||
obj.toString();
|
||||
}
|
||||
|
||||
void interTargetNativeNPEBad(Class1 class1) {
|
||||
Object obj = class1.nativeMayReturnNull();
|
||||
obj.toString();
|
||||
}
|
||||
|
||||
void followMethodDeclarationOnlyBad(SkipImplementationClass1 obj1) {
|
||||
Object obj2 = obj1.annotatedNullable();
|
||||
obj2.toString();
|
||||
}
|
||||
|
||||
void followMethodDeclarationOnlyOk(SkipImplementationClass1 obj1) {
|
||||
Object obj2 = obj1.notAnnotatedNullable();
|
||||
obj2.toString();
|
||||
}
|
||||
|
||||
void dereferenceLocalNullableFieldBad() {
|
||||
field.toString();
|
||||
}
|
||||
|
||||
void dereferenceInterTargetField1Bad(Class1 class1) {
|
||||
class1.field1.toString();
|
||||
}
|
||||
|
||||
int dereferenceInterTargetField2Bad(Class1 class1) {
|
||||
return class1.field2.x;
|
||||
}
|
||||
|
||||
void dereferenceUnannotatedMethodReturningNullBad(Class1 class1) {
|
||||
class1.unannotatedReturnNull().toString();
|
||||
}
|
||||
|
||||
static class Sub extends Class1.Sub {
|
||||
@Override
|
||||
public @Nullable Object subtypingInconsistency(Object object) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
[buildfile]
|
||||
includes = //DEFS
|
||||
|
||||
[project]
|
||||
ignore = .git, .ml, .mli
|
||||
|
||||
[java]
|
||||
source_level = 8
|
||||
target_level = 8
|
@ -1 +0,0 @@
|
||||
../../../../.buckversion
|
@ -1,52 +0,0 @@
|
||||
import os
|
||||
|
||||
original_java_library = java_library
|
||||
def java_library(
|
||||
name,
|
||||
srcs=[],
|
||||
**kwargs
|
||||
):
|
||||
|
||||
original_java_library(
|
||||
name=name,
|
||||
srcs=srcs,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
create_infer_genrule(name, srcs)
|
||||
|
||||
original_android_library = android_library
|
||||
def android_library(
|
||||
name,
|
||||
srcs=[],
|
||||
**kwargs
|
||||
):
|
||||
|
||||
original_android_library(
|
||||
name=name,
|
||||
srcs=srcs,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
create_infer_genrule(name, srcs)
|
||||
|
||||
def create_infer_genrule(
|
||||
name,
|
||||
srcs
|
||||
):
|
||||
genrule_name = name + '_infer'
|
||||
genrule(
|
||||
name = genrule_name,
|
||||
srcs=srcs,
|
||||
cmd = ' '.join([
|
||||
os.getenv('INFER_BIN', 'infer'),
|
||||
'--genrule-mode',
|
||||
'--project-root', os.getenv('PROJECT_ROOT', os.environ['PWD']),
|
||||
'--eradicate-only',
|
||||
'--results-dir', '$OUT',
|
||||
'--classpath', '$(classpath :{})'.format(name),
|
||||
'--sourcepath', '$SRCDIR',
|
||||
'--generated-classes', '$(location :{})'.format(name),
|
||||
]),
|
||||
out = 'infer_out',
|
||||
)
|
@ -1,21 +0,0 @@
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
TESTS_DIR = ../..
|
||||
|
||||
BUCK_TARGET = //module2:module2
|
||||
INFERPRINT_OPTIONS = --issues-tests
|
||||
CLEAN_EXTRA = buck-out
|
||||
SOURCES = $(shell find . -name '*.java')
|
||||
|
||||
include $(TESTS_DIR)/java.make
|
||||
include $(TESTS_DIR)/infer.make
|
||||
|
||||
infer-out/report.json: $(JAVA_DEPS) $(JAVA_SOURCE_FILES)
|
||||
$(QUIET)$(REMOVE_DIR) buck-out && \
|
||||
$(call silent_on_success,Testing Buck Java cross module integration,\
|
||||
INFER_BIN=$(INFER_BIN) \
|
||||
$(INFER_BIN) --buck-java-deprecated --results-dir $(CURDIR)/infer-out -- \
|
||||
$(BUCK) build --no-cache $(BUCK_TARGET))
|
@ -1,7 +0,0 @@
|
||||
java_library(
|
||||
name='annotations',
|
||||
srcs=['Nullable.java'],
|
||||
visibility=[
|
||||
'PUBLIC'
|
||||
],
|
||||
)
|
@ -1,9 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
package genrule.annotations;
|
||||
|
||||
public @interface Nullable {}
|
@ -1,2 +0,0 @@
|
||||
module2/Class2.java, crossmodule.module2.Class2.crossModuleNPE1():void, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure crossModuleNPE1(),start of procedure returnsNull(),return from a call to String Class1.returnsNull()]
|
||||
module2/Class2.java, crossmodule.module2.Class2.crossModuleNPE2(crossmodule.module1.Class1):void, 1, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure crossModuleNPE2(...)]
|
@ -1,10 +0,0 @@
|
||||
java_library(
|
||||
name='module1',
|
||||
srcs=['Class1.java'],
|
||||
deps=[
|
||||
'//annotations:annotations',
|
||||
],
|
||||
visibility=[
|
||||
'PUBLIC'
|
||||
],
|
||||
)
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package crossmodule.module1;
|
||||
|
||||
import genrule.annotations.Nullable;
|
||||
|
||||
public class Class1 {
|
||||
|
||||
public static String returnsNull() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable public Object nullableField;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
java_library(
|
||||
name='module2',
|
||||
srcs=['Class2.java'],
|
||||
deps=[
|
||||
'//module1:module1'
|
||||
]
|
||||
)
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package crossmodule.module2;
|
||||
|
||||
import crossmodule.module1.Class1;
|
||||
|
||||
public class Class2 {
|
||||
|
||||
void crossModuleNPE1() {
|
||||
Class1.returnsNull().toString();
|
||||
}
|
||||
|
||||
void crossModuleNPE2(Class1 c) {
|
||||
c.nullableField.toString();
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
[tools]
|
||||
javac_jar = /dev/null
|
@ -1 +0,0 @@
|
||||
../../../../.buckversion
|
@ -1,26 +0,0 @@
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
TESTS_DIR = ../..
|
||||
ROOT_DIR = $(TESTS_DIR)/../..
|
||||
|
||||
TARGET = //src:target
|
||||
SOURCES = src/UsingJavacJar.java
|
||||
OBJECTS = buck-out/gen/src/lib__target__output/target.jar
|
||||
BUCKCONFIG = .buckconfig
|
||||
INFER_OPTIONS = --eradicate-only --buck-java-deprecated
|
||||
INFERPRINT_OPTIONS = --issues-tests
|
||||
CLEAN_EXTRA = buck-out
|
||||
|
||||
include $(TESTS_DIR)/infer.make
|
||||
|
||||
$(OBJECTS): $(SOURCES) $(BUCKCONFIG)
|
||||
$(TESTLOCK) $(BUCK) build --config tools.javac_jar= $(TARGET)
|
||||
|
||||
infer-out/report.json: $(JAVA_DEPS) $(SOURCES) $(BUCKCONFIG)
|
||||
$(QUIET)$(REMOVE_DIR) buck-out && \
|
||||
$(call silent_on_success,Testing Buck Java integration with javac_jar,\
|
||||
INFER_BIN=$(INFER_BIN) \
|
||||
$(INFER_BIN) $(INFER_OPTIONS) -- $(BUCK) build $(TARGET))
|
@ -1 +0,0 @@
|
||||
src/UsingJavacJar.java, UsingJavacJar.foo():java.lang.Object, 0, ERADICATE_RETURN_NOT_NULLABLE, no_bucket, WARNING, [`foo()`: return type is declared non-nullable but the method returns `null`: null constant at line 10.]
|
@ -1,4 +0,0 @@
|
||||
java_library(
|
||||
name = 'target',
|
||||
srcs = glob(['*.java']),
|
||||
)
|
@ -1,12 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
public class UsingJavacJar {
|
||||
|
||||
Object foo() {
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue