Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: <java> #20,incorrect TypeValue and TypeKey #21

Merged
merged 1 commit into from
Aug 24, 2022
Merged
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 @@ -531,10 +531,12 @@ open class JavaFullIdentListener(fileName: String, val classes: Array<String>) :
}

val typeTypeText = typeCtx.identifier(0).text
val typeValue = declCtx.variableDeclaratorId().identifier().text
fieldsMap[typeValue] = typeTypeText
val typeKey = declCtx.variableDeclaratorId().identifier().text
val typeValue = declCtx.variableInitializer()?.text ?: ""

fieldsMap[typeKey] = typeTypeText

val field = CodeField(typeTypeText, typeValue, Modifiers = arrayOf(), Annotations = this.currentAnnotations)
val field = CodeField(typeTypeText, typeValue, typeKey, Modifiers = arrayOf(), Annotations = this.currentAnnotations)
fields += field

buildFieldCall(typeTypeText, ctx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ package hello;

public class JavaCallApp {
private JavaDaoParser daoParser;
private String name = "abc";

public daoCall() {
daoParser.Call();
Expand All @@ -123,9 +124,13 @@ public class JavaCallApp {
val codeFile = JavaAnalyser().identFullInfo(code, "")
println(codeFile.DataStructures[0].Fields.size)

assertEquals(codeFile.DataStructures[0].Fields.size, 1)
assertEquals(codeFile.DataStructures[0].Fields.size, 2)
assertEquals(codeFile.DataStructures[0].Fields[0].TypeType, "JavaDaoParser")
assertEquals(codeFile.DataStructures[0].Fields[0].TypeValue, "daoParser")
assertEquals(codeFile.DataStructures[0].Fields[0].TypeKey, "daoParser")

assertEquals(codeFile.DataStructures[0].Fields[1].TypeType, "String")
assertEquals(codeFile.DataStructures[0].Fields[1].TypeKey, "name")
assertEquals(codeFile.DataStructures[0].Fields[1].TypeValue, "\"abc\"")
}

@Test
Expand Down