Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,13 @@ private static Collection<String> extractInterfaces(ClassNode classNode) {
private static List<Symbol> extractFields(ClassNode classNode) {
List<Symbol> fields = new ArrayList<>();
for (FieldNode fieldNode : classNode.fields) {
SymbolType symbolType =
ASMHelper.isStaticField(fieldNode) ? SymbolType.STATIC_FIELD : SymbolType.FIELD;
boolean isStatic = ASMHelper.isStaticField(fieldNode);
boolean isFinal = ASMHelper.isFinalField(fieldNode);
if (isFinal && isStatic) {
// skip final static fields, considered as constant and not captured by context probes
continue;
}
SymbolType symbolType = isStatic ? SymbolType.STATIC_FIELD : SymbolType.FIELD;
LanguageSpecifics fieldSpecifics =
new LanguageSpecifics.Builder()
.addModifiers(extractFieldModifiers(fieldNode.access))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -837,23 +837,8 @@ public void symbolExtraction14() throws IOException, URISyntaxException {
Enum.class.getTypeName(),
null,
null);
assertEquals(4, myEnumClassScope.getSymbols().size());
Symbol oneField = myEnumClassScope.getSymbols().get(0);
assertLangSpecifics(
oneField.getLanguageSpecifics(),
asList("public", "static", "final", "enum"),
null,
null,
null,
null);
Symbol valuesField = myEnumClassScope.getSymbols().get(3);
assertLangSpecifics(
valuesField.getLanguageSpecifics(),
asList("private", "static", "final", "synthetic"),
null,
null,
null,
null);
// enum constants are static final fields and therefore not extracted
assertEquals(0, myEnumClassScope.getSymbols().size());
}

@Test
Expand Down