Skip to content

Commit

Permalink
Remove InferredJARModelsHandler (#1079)
Browse files Browse the repository at this point in the history
Now, all logic for parsing loading `astubx` files is consolidated into
the `LibraryModelsHandler.ExternalStubxLibraryModels` class and is
uniform for `astubx` files generated via JarInfer or from source code,
which will ease future bug fixes and changes.

We copied over the logic from `InferredJARModelsHandler` for loading
Android SDK models if present. We also update the logic for
`ExternalStubxLibraryModels.nonNullParameters()` and
`ExternalStubxLibraryModels.nullableReturns()` to pull in all the
relevant info from the parsed `astubx` file.

Fixes #1072
  • Loading branch information
msridhar authored Dec 16, 2024
1 parent 9ff664a commit cb3ff51
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 252 deletions.
9 changes: 8 additions & 1 deletion nullaway/src/main/java/com/uber/nullaway/LibraryModels.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,14 @@ private MethodRef(String enclosingClass, String methodName, String fullMethodSig
this.fullMethodSig = fullMethodSig;
}

private static final Pattern METHOD_SIG_PATTERN = Pattern.compile("^(<.*>)?(\\w+)(\\(.*\\))$");
/**
* Pattern for parsing method signatures. The signature should be in the format: {@code
* <T1,T2,...>methodName(ArgType1,ArgType2,...)}.
*
* @see #methodRef(String, String)
*/
private static final Pattern METHOD_SIG_PATTERN =
Pattern.compile("^(<.*>)?(\\w+|<init>)(\\(.*\\))$");

/**
* Construct a method reference.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ public static Handler buildDefault(Config config) {
// bytecode annotations
handlerListBuilder.add(new RestrictiveAnnotationHandler(config));
}
if (config.isJarInferEnabled()) {
handlerListBuilder.add(new InferredJARModelsHandler());
}
if (config.handleTestAssertionLibraries()) {
handlerListBuilder.add(new AssertionHandler(methodNameUtil));
}
Expand Down

This file was deleted.

Loading

0 comments on commit cb3ff51

Please sign in to comment.