*old repository* --> this is now integrated in https://github.com/javaparser/javaparser

Overview

JavaSymbolSolver has been integrated in JavaParser: development will continue there!

We will work on current issues opened here, but all new issues should be opened in the JavaParser project

JavaSymbolSolver

Maven Central Build Status

A Symbol Solver for Java built on top of JavaParser from the same team of committers.

Documentation

Currently the best source of documentation is in this book

You can also read this article:

How this complement JavaParser?

JavaParser is a parser: given a source file it recognizes the different syntatic element and produce an Abstract Syntax Tree (AST).

JavaSymbolSolver analyzes that AST and find the declarations connected to each element.

foo in the AST is just a name, JavaSymbolSolver can tell you if it refers to a parameter, a local variable, a field. It can also give you the type, tell you where the element has been defined and so on.

What can I use it for?

A Symbol Solver can associate a symbol in your code to its declaration. This is necessary to verify the type of an expression or to find the usage of a symbol (like a field or a local variable):

Consider this:

int a = 0;

void foo() {
    while (true) {
        String a = "hello!";
        Object foo = a + 1;
    }
}

In the expression a + 1 a parser (like JavaParser) is not able to tell us to which definition of a we are referring to and consequently it cannot tell us the type of a. The JavaSymbolSolver is able to do so.

How can I use it? Show me some code!

Take a look at JavaParserFacade. For example you can use it to find the type of an expression:

Node node = <get this node by parsing source code with JavaParser>
Type typeOfTheNode = JavaParserFacade.get(typeSolver).getType(node);

Easy, right?

The only configuration that it requires is part of the TypeSolver instance to pass it. A TypeSolver is the mechanism that is used to find the classes referenced in your code. For example your class could import or extend a given class and the TypeSolver will find it and build a model of it, later used to solve symbols. Basically there are four TypeSolver:

  • JavaParserTypeSolver: look for the type in a directory of source files
  • JarTypeSolver: look for the type in a JAR file
  • ReflectionTypeSolver: look for the type using reflection. This is needed because some classes are not available in any other way (for example the Object class). However this should be used exclusively for files in the java or javax packages
  • CombinedTypeSolver: permits to combine several instances of TypeSolvers

In the tests you can find an example of instantiating TypeSolvers:

CombinedTypeSolver combinedTypeSolver = new CombinedTypeSolver();
combinedTypeSolver.add(new ReflectionTypeSolver());
combinedTypeSolver.add(new JavaParserTypeSolver(new File("src/test/resources/javaparser_src/proper_source")));
combinedTypeSolver.add(new JavaParserTypeSolver(new File("src/test/resources/javaparser_src/generated")));

Typically to analize a project you want to create one instance of JavaParserTypeSolver for each source directory, one instance of JarTypeSolver for each dependency and one ReflectionTypeSolver then you can combine all of them in a CombinedTypeSolver and pass that around.

Tutorial on resolving method calls

We plan to write soon more examples and tutorials.

Status of the project

This project is more recent of JavaParser but it has been receiving some attention and it has been improving a lot recently.

It supports all features of Java 8 (lambdas, generic, type inference, etc.). Of course we expect some bugs to emerge from time to time but we are committed to help users solve them as soon as possible.

It has been also used in a commercial product from Coati.

License

This code is available under the Apache License.

Development

We use Travis to ensure our tests are passing all the time.

The dev-files dir contains configurations for the Eclipse and the IDEA formatters (I took them from the JavaParser project, thanks guys!).

The project is structured in this way:

  • We have nodes that wrap the JavaParser nodes (but can also wrap Javassist or JRE nodes)
  • The nodes contain all the information of the AST
  • Context classes contain the logic to solve methods, symbols and types in the respective context.
  • Default fallback behavior: ask the parent context for help (so if a variable identifier cannot be solved inside a MethodContext the underlying ClassDeclarationContext is asked and maybe we find out that the identifier actually refers to a field.

A more detailed description of the architecture of the project is available in Design.MD

Gradle usage

We suggest that you use the local gradle wrapper within java-symbol-solver to execute gradle tasks. If you're working on a Linux or Mac system, this is ./gradlew in the root directory of java-symbol-solver. On Windows, it's gradlew.bat. When executing gradle tasks via your IDE, make sure to configure your IDE to also use this wrapper. If you use intelliJ, you need the "Use default Gradle wrapper" option in the IntelliJ Gradle settings.

The following tasks are most relevant:

  • assemble: If you need to build the source code (the full command thus becomes .\gradlew assemble or .\gradlew.bat assemble depending on your Operating System).
  • check: To run the tests
  • check jacocoTestReport: To run the tests (if still necessary) and generate a test coverage report. This coverage report is then located at ./java-symbol-solver-testing/build/jacocoHtml/index.html relative to your project root.
  • install: To install the snapshot version of the project to your local maven repository, which can be useful to test changes you're working on against external projects.

In case you haven't worked with Gradle before, one thing of note is that Gradle will only perform tasks that are still relevant. Let's say you have subprojects foo and bar and you had previously compiled those. If you then make changes in foo and compile both again, only foo will be compiled. You'll see in the Gradle output that the compile task of bar is marked as UP-TO-DATE.

Contributing

I would absolutely love every possible kind of contributions: if you have questions, ideas, need help or want to propose a change just open an issue. Pull-requests are greatly appreciated.

Thanks to Malte Langkabel, Ayman Abdelghany, Evan Rittenhouse, Rachel Pau, Pavel Eremeev, Simone Basso, Rafael Vargas, Christophe Creeten, Fred Lefévère-Laoide, and Genadz Batsyan for their contributions!

The project has been created by Federico Tomassetti and it is currently co-maintained by the JavaParser team. Core contributors are currently Malte Langkabel and Panayiotis Pastos

Comments
  • getting Context for ArrayType not working anymore

    getting Context for ArrayType not working anymore

    It seems like in the new version of the Javaparser (including 3.0.0 Alpha 6) the ArrayType is not a real part of the AST anymore. So when the JavaparserFactory asks an ArrayType node for its parent in order to provide a Context, the parent is just a null value.

    bug 
    opened by mlangkabel 21
  • Type of BinaryExpr is not correctly resolved in certain situations

    Type of BinaryExpr is not correctly resolved in certain situations

    Consider the following expression:

    String s = false + "str";

    Trying to resolve the type of the subexpression false + "str" gives me the following ResolvedType: PrimitiveTypeUsage{name='boolean'}.

    That's wrong of course, it should be a string. When the literals are the other way around, i.e., when I try to resolve "str" + false in the following expression:

    String s = "str" + false;

    ...it works fine, I get a ReferenceType{java.lang.String, typeParametersMap=TypeParametersMap{nameToValue={}}}. That's what I would have expected in the first case too.

    Is this a bug?

    I tried to resolve the expression as follows. I used JavaParserFacade.get(typeSolver).getType(node). Here, typeSolver is a CombinedTypeSolver of a ReflectionTypeSolver and a JavaParserTypeSolver of a directory with a file that contains this above expression. And of course, node is the Expression that corresponds to the sub-expression false + "str" (like, expressionStmt.getExpression().asVariableDeclarationExpr() .getVariable(0).getInitializer().get()).

    bug 
    opened by malteskoruppa 14
  • Several errors messages in Android project

    Several errors messages in Android project

    I got the example project, edited the typeSolver function as below and ran against the project https://github.com/adorilson/TestJavaSymbolSolver (it has a few files but it is big (in bytes) because the libs/android.jar file).

    fun typeSolver() : TypeSolver { val combinedTypeSolver = CombinedTypeSolver() combinedTypeSolver.add(JreTypeSolver()) combinedTypeSolver.add(JarTypeSolver("/home/adorilson/workspace/TestJavaSymbolResolv/libs/android.jar")) return combinedTypeSolver }

    The result was

    `/usr/lib/jvm/java-8-oracle/bin/java -Didea.launcher.port=7532 -Didea.launcher.bin.path=/home/adorilson/workspace/ides/inteliij_idea/bin -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-8-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-8-oracle/jre/lib/deploy.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/jfxrt.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-oracle/jre/lib/javaws.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jfxswt.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-8-oracle/jre/lib/management-agent.jar:/usr/lib/jvm/java-8-oracle/jre/lib/plugin.jar:/usr/lib/jvm/java-8-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar:/home/adorilson/workspace/labs/java-symbol-solver-examples/build/classes/main:/home/adorilson/workspace/labs/java-symbol-solver-examples/build/resources/main:/home/adorilson/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-runtime/1.0.4/8e25da5e31669f5acf514bdd99b94ff5c7003b3b/kotlin-runtime-1.0.4.jar:/home/adorilson/.gradle/caches/modules-2/files-2.1/antlr/antlr/2.7.7/83cd2cd674a217ade95a4bb83a8a14f351f48bd0/antlr-2.7.7.jar:/home/adorilson/.gradle/caches/modules-2/files-2.1/me.tomassetti/java-symbol-solver-core/0.3.1/52043462c4095e63be7ff6aac876b7cb69147b01/java-symbol-solver-core-0.3.1.jar:/home/adorilson/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.0.4/9c8d1a5d2eea3c9a7f58baa1a2fa11498cb41d0/kotlin-stdlib-1.0.4.jar:/home/adorilson/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.0.4/ab1d288da47c0d798553ccea9d8b4fd6a0e3b8e4/kotlin-reflect-1.0.4.jar:/home/adorilson/.gradle/caches/modules-2/files-2.1/com.github.javaparser/javaparser-core/3.0.0-alpha.2/1091de18b6b716599487746d86ae2b5aef5b3373/javaparser-core-3.0.0-alpha.2.jar:/home/adorilson/.gradle/caches/modules-2/files-2.1/com.javaslang/javaslang/2.0.0-beta/416a646e077c56ad21e69f3cec230ac97b548913/javaslang-2.0.0-beta.jar:/home/adorilson/.gradle/caches/modules-2/files-2.1/io.javaslang/javaslang-match/2.0.3/f3864db5c92a9a14bb61d31817266d66b9401494/javaslang-match-2.0.3.jar:/home/adorilson/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.19.0-GA/50120f69224dd8684b445a6f3a5b08fe9b5c60f6/javassist-3.19.0-GA.jar:/home/adorilson/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/18.0/cce0823396aa693798f8882e64213b1772032b09/guava-18.0.jar:/home/adorilson/.gradle/caches/modules-2/files-2.1/me.tomassetti/java-symbol-solver-model/0.3.1/71e6f48896e05bc6f4b6c5f2f8a89748212eec5b/java-symbol-solver-model-0.3.1.jar:/home/adorilson/.gradle/caches/modules-2/files-2.1/me.tomassetti/java-symbol-solver-logic/0.3.1/602298dfb5073c8a96162c780245b54c352e98c2/java-symbol-solver-logic-0.3.1.jar:/home/adorilson/.gradle/caches/modules-2/files-2.1/io.javaslang/javaslang/2.0.3/a6f2b899759cc7fe68e23062893285adb2aa580c/javaslang-2.0.3.jar:/home/adorilson/workspace/ides/inteliij_idea/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain MethodUsageKt /home/adorilson/workspace/TestJavaSymbolResolv/app/src/test/java/com/example/adorilson/testjavasymbolresolv/ExampleUnitTest.java /home/adorilson/workspace/TestJavaSymbolResolv/app/src/androidTest/java/com/example/adorilson/testjavasymbolresolv/ApplicationTest.java /home/adorilson/workspace/TestJavaSymbolResolv/app/src/main/java/com/example/adorilson/testjavasymbolresolv/LegacySleepPolicy.java

    • L13 context.getContentResolver() -> android.content.Context.getContentResolver()
    • L14 android.provider.Settings.System.putInt(cr, android.provider.Settings.System.WIFI_SLEEP_POLICY, policy) ERR Unable to calculate the type of a parameter of a method call. Method call: android.provider.Settings.System.putInt(cr, android.provider.Settings.System.WIFI_SLEEP_POLICY, policy), Parameter: android.provider.Settings.System.WIFI_SLEEP_POLICY
    • L20 context.getContentResolver() -> android.content.Context.getContentResolver()
    • L23 Settings.System.getInt(cr, Settings.System.WIFI_SLEEP_POLICY) ERR Unable to calculate the type of a parameter of a method call. Method call: Settings.System.getInt(cr, Settings.System.WIFI_SLEEP_POLICY), Parameter: Settings.System.WIFI_SLEEP_POLICY /home/adorilson/workspace/TestJavaSymbolResolv/app/src/main/java/com/example/adorilson/testjavasymbolresolv/JellyBeanSleepPolicy.java
    • L19 NotifUtil.show(context, getSleepPolicyString(policy), "Tap to set", getPendingIntent(context)) ERR Unable to calculate the type of a parameter of a method call. Method call: NotifUtil.show(context, getSleepPolicyString(policy), "Tap to set", getPendingIntent(context)), Parameter: getSleepPolicyString(policy)
    • L19 getSleepPolicyString(policy) ERR Unsolved symbol in me.tomassetti.symbolsolver.javaparsermodel.contexts.ClassOrInterfaceDeclarationContext@191eeb6c : SleepPolicyHelper
    • L19 getPendingIntent(context) ERR Unsolved symbol in me.tomassetti.symbolsolver.javaparsermodel.contexts.ClassOrInterfaceDeclarationContext@191eeb6c : SleepPolicyHelper
    • L25 context.getContentResolver() -> android.content.Context.getContentResolver()
    • L28 Settings.Global.getInt(cr, Settings.Global.WIFI_SLEEP_POLICY) ERR Unable to calculate the type of a parameter of a method call. Method call: Settings.Global.getInt(cr, Settings.Global.WIFI_SLEEP_POLICY), Parameter: Settings.Global.WIFI_SLEEP_POLICY
    • L36 new Intent(Settings.ACTION_WIFI_SETTINGS).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) ERR Unable to calculate the type of a parameter of a method call. Method call: new Intent(Settings.ACTION_WIFI_SETTINGS).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK), Parameter: Intent.FLAG_ACTIVITY_NEW_TASK
    • L37 PendingIntent.getActivity(context, NotifUtil.getPendingIntentCode(), intent, PendingIntent.FLAG_UPDATE_CURRENT) ERR Unable to calculate the type of a parameter of a method call. Method call: PendingIntent.getActivity(context, NotifUtil.getPendingIntentCode(), intent, PendingIntent.FLAG_UPDATE_CURRENT), Parameter: NotifUtil.getPendingIntentCode()
    • L37 NotifUtil.getPendingIntentCode() ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=NotifUtil.getPendingIntentCode()} /home/adorilson/workspace/TestJavaSymbolResolv/app/src/main/java/com/example/adorilson/testjavasymbolresolv/utility/StatusDispatcher.java
    • L40 messagehandler.obtainMessage(REFRESH) -> android.os.Handler.obtainMessage(int)
    • L41 in.setData(intent.getExtras()) -> android.os.Message.setData(android.os.Bundle)
    • L41 intent.getExtras() -> android.content.Intent.getExtras()
    • L42 messagehandler.sendMessage(in) -> android.os.Handler.sendMessage(android.os.Message)
    • L56 message.peekData() ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=message.peekData()}
    • L57 host.get().post(new Widget(_statusMessage)) ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=host.get().post(new Widget(_statusMessage))}
    • L57 host.get() ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=host.get()}
    • L59 host.get().post(new Widget(StatusMessage.fromMessage(message))) ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=host.get().post(new Widget(StatusMessage.fromMessage(message)))}
    • L59 host.get() ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=host.get()}
    • L60 StatusMessage.fromMessage(message) ERR Unable to calculate the type of a parameter of a method call. Method call: StatusMessage.fromMessage(message), Parameter: message
    • L65 StatusMessage.updateFromMessage(_statusMessage, message) ERR Unable to calculate the type of a parameter of a method call. Method call: StatusMessage.updateFromMessage(_statusMessage, message), Parameter: _statusMessage
    • L66 host.get().post(new FastStatus(_statusMessage)) ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=host.get().post(new FastStatus(_statusMessage))}
    • L66 host.get() ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=host.get()}
    • L67 host.get().post(new StatNotif(_statusMessage)) ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=host.get().post(new StatNotif(_statusMessage))}
    • L67 host.get() ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=host.get()}
    • L68 this.hasMessages(WIDGET_REFRESH) ERR Unable to calculate the type of a parameter of a method call. Method call: this.hasMessages(WIDGET_REFRESH), Parameter: WIDGET_REFRESH
    • L69 this.sendEmptyMessageDelayed(WIDGET_REFRESH, WIDGET_REFRESH_DELAY) ERR Unable to calculate the type of a parameter of a method call. Method call: this.sendEmptyMessageDelayed(WIDGET_REFRESH, WIDGET_REFRESH_DELAY), Parameter: WIDGET_REFRESH
    • L99 i.putExtras(message.status) ERR Unable to calculate the type of a parameter of a method call. Method call: i.putExtras(message.status), Parameter: message.status
    • L115 intent.putExtra(STATUS_DATA_KEY, message.status) ERR Unable to calculate the type of a parameter of a method call. Method call: intent.putExtra(STATUS_DATA_KEY, message.status), Parameter: message.status
    • L116 c.get().sendBroadcast(intent) -> android.content.Context.sendBroadcast(android.content.Intent)
    • L116 c.get() -> java.lang.ref.Reference.get()
    • L123 messagehandler.hasMessages(REFRESH) -> android.os.Handler.hasMessages(int)
    • L124 messagehandler.removeMessages(REFRESH) -> android.os.Handler.removeMessages(int)
    • L125 messagehandler.hasMessages(WIDGET_REFRESH) -> android.os.Handler.hasMessages(int)
    • L126 messagehandler.removeMessages(WIDGET_REFRESH) -> android.os.Handler.removeMessages(int)
    • L131 clearQueue() -> com.example.adorilson.testjavasymbolresolv.utility.StatusDispatcher.clearQueue()
    • L135 clearQueue() -> com.example.adorilson.testjavasymbolresolv.utility.StatusDispatcher.clearQueue()
    • L137 messagehandler.sendEmptyMessage(WIDGET_REFRESH) -> android.os.Handler.sendEmptyMessage(int)
    • L139 messagehandler.obtainMessage(WIDGET_REFRESH) -> android.os.Handler.obtainMessage(int)
    • L140 send.setData(n.status) ERR Unable to calculate the type of a parameter of a method call. Method call: send.setData(n.status), Parameter: n.status
    • L141 messagehandler.sendMessage(send) -> android.os.Handler.sendMessage(android.os.Message) /home/adorilson/workspace/TestJavaSymbolResolv/app/src/main/java/com/example/adorilson/testjavasymbolresolv/utility/StatusMessage.java
    • L24 this.setSSID(StringUtil.removeQuotes(ssid)) ERR Unable to calculate the type of a parameter of a method call. Method call: this.setSSID(StringUtil.removeQuotes(ssid)), Parameter: StringUtil.removeQuotes(ssid)
    • L24 StringUtil.removeQuotes(ssid) ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=StringUtil.removeQuotes(ssid)}
    • L25 this.setStatus(smessage) -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.setStatus(java.lang.String)
    • L26 this.setSignal(si) -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.setSignal(int)
    • L27 this.setShow(sh) -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.setShow(int)
    • L40 s.status.putAll(m.getData()) -> android.os.Bundle.putAll(android.os.Bundle)
    • L40 m.getData() -> android.os.Message.getData()
    • L46 i.getBundleExtra(StatusDispatcher.STATUS_DATA_KEY) ERR Unable to calculate the type of a parameter of a method call. Method call: i.getBundleExtra(StatusDispatcher.STATUS_DATA_KEY), Parameter: StatusDispatcher.STATUS_DATA_KEY
    • L51 m.getData() -> android.os.Message.getData()
    • L52 b.containsKey(SSID_KEY) -> android.os.BaseBundle.containsKey(java.lang.String)
    • L52 b.getString(SSID_KEY) -> android.os.BaseBundle.getString(java.lang.String)
    • L53 b.getString(SSID_KEY).length() -> java.lang.String.length()
    • L53 b.getString(SSID_KEY) -> android.os.BaseBundle.getString(java.lang.String)
    • L54 b.equals(s.getSSID()) -> java.lang.Object.equals(java.lang.Object)
    • L54 s.getSSID() -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.getSSID()
    • L55 s.setSSID(b.getString(SSID_KEY)) -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.setSSID(java.lang.String)
    • L55 b.getString(SSID_KEY) -> android.os.BaseBundle.getString(java.lang.String)
    • L56 b.containsKey(STATUS_KEY) -> android.os.BaseBundle.containsKey(java.lang.String)
    • L56 b.getString(STATUS_KEY) -> android.os.BaseBundle.getString(java.lang.String)
    • L57 b.getString(STATUS_KEY).length() -> java.lang.String.length()
    • L57 b.getString(STATUS_KEY) -> android.os.BaseBundle.getString(java.lang.String)
    • L58 b.equals(s.getStatus()) -> java.lang.Object.equals(java.lang.Object)
    • L58 s.getStatus() -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.getStatus()
    • L59 s.setStatus(b.getString(STATUS_KEY)) -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.setStatus(java.lang.String)
    • L59 b.getString(STATUS_KEY) -> android.os.BaseBundle.getString(java.lang.String)
    • L60 b.containsKey(SIGNAL_KEY) -> android.os.BaseBundle.containsKey(java.lang.String)
    • L60 b.getInt(SIGNAL_KEY) -> android.os.BaseBundle.getInt(java.lang.String)
    • L60 s.getSignal() -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.getSignal()
    • L61 s.setSignal(b.getInt(SIGNAL_KEY)) -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.setSignal(int)
    • L61 b.getInt(SIGNAL_KEY) -> android.os.BaseBundle.getInt(java.lang.String)
    • L62 b.containsKey(SHOW_KEY) -> android.os.BaseBundle.containsKey(java.lang.String)
    • L62 b.getInt(SHOW_KEY) -> android.os.BaseBundle.getInt(java.lang.String)
    • L63 b.getInt(SHOW_KEY) -> android.os.BaseBundle.getInt(java.lang.String)
    • L63 s.getShow() -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.getShow()
    • L64 s.setShow(b.getInt(SHOW_KEY)) -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.setShow(int)
    • L64 b.getInt(SHOW_KEY) -> android.os.BaseBundle.getInt(java.lang.String)
    • L65 b.containsKey(LINK_KEY) -> android.os.BaseBundle.containsKey(java.lang.String)
    • L66 b.getString(LINK_KEY) -> android.os.BaseBundle.getString(java.lang.String)
    • L67 ls.contains(MB) -> java.lang.String.contains(java.lang.CharSequence)
    • L68 s.setLinkSpeed(ls.concat(MB)) -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.setLinkSpeed(java.lang.String)
    • L68 ls.concat(MB) -> java.lang.String.concat(java.lang.String)
    • L74 getSSID() -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.getSSID()
    • L75 out.append(getStatus()) -> java.lang.StringBuilder.append(java.lang.String)
    • L75 getStatus() -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.getStatus()
    • L76 out.append(getSignal()) -> java.lang.StringBuilder.append(int)
    • L76 getSignal() -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.getSignal()
    • L77 out.append(getShow()) -> java.lang.StringBuilder.append(int)
    • L77 getShow() -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.getShow()
    • L78 out.append(getLinkSpeed()) -> java.lang.StringBuilder.append(java.lang.String)
    • L78 getLinkSpeed() -> com.example.adorilson.testjavasymbolresolv.utility.StatusMessage.getLinkSpeed()
    • L79 out.toString() -> java.lang.StringBuilder.toString()
    • L83 status.getString(LINK_KEY) -> android.os.BaseBundle.getString(java.lang.String)
    • L87 status.putString(LINK_KEY, s) -> android.os.BaseBundle.putString(java.lang.String, java.lang.String)
    • L92 status.getString(SSID_KEY) -> android.os.BaseBundle.getString(java.lang.String)
    • L98 status.putString(SSID_KEY, StringUtil.removeQuotes(s)) ERR Unable to calculate the type of a parameter of a method call. Method call: status.putString(SSID_KEY, StringUtil.removeQuotes(s)), Parameter: StringUtil.removeQuotes(s)
    • L98 StringUtil.removeQuotes(s) ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=StringUtil.removeQuotes(s)}
    • L103 status.getString(STATUS_KEY) -> android.os.BaseBundle.getString(java.lang.String)
    • L109 status.putString(STATUS_KEY, s) -> android.os.BaseBundle.putString(java.lang.String, java.lang.String)
    • L114 status.putString(STATUS_KEY, c.getString(s)) -> android.os.BaseBundle.putString(java.lang.String, java.lang.String)
    • L114 c.getString(s) -> android.content.Context.getString(int)
    • L119 status.getInt(SIGNAL_KEY) -> android.os.BaseBundle.getInt(java.lang.String)
    • L123 status.putInt(SIGNAL_KEY, i) -> android.os.BaseBundle.putInt(java.lang.String, int)
    • L128 status.getInt(SHOW_KEY) -> android.os.BaseBundle.getInt(java.lang.String)
    • L132 status.putInt(SHOW_KEY, sh) -> android.os.BaseBundle.putInt(java.lang.String, int) /home/adorilson/workspace/TestJavaSymbolResolv/app/src/main/java/com/example/adorilson/testjavasymbolresolv/utility/NotifUtil.java
    • L57 _notifStack.size() -> java.util.ArrayList.size()
    • L62 builder.build() ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=builder.build()}
    • L64 builder.build() ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=builder.build()}
    • L65 in.getSignal() ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=in.getSignal()}
    • L81 _notifStack.add(0, holder) -> java.util.ArrayList.add(int, E)
    • L82 generateBuilder(context, holder) -> com.example.adorilson.testjavasymbolresolv.utility.NotifUtil.generateBuilder(android.content.Context, com.example.adorilson.testjavasymbolresolv.utility.NotifUtil.NotificationHolder)
    • L93 PendingIntent.getBroadcast(context, getPendingIntentCode(), intent, PendingIntent.FLAG_UPDATE_CURRENT) ERR Unable to calculate the type of a parameter of a method call. Method call: PendingIntent.getBroadcast(context, getPendingIntentCode(), intent, PendingIntent.FLAG_UPDATE_CURRENT), Parameter: PendingIntent.FLAG_UPDATE_CURRENT
    • L93 getPendingIntentCode() -> com.example.adorilson.testjavasymbolresolv.utility.NotifUtil.getPendingIntentCode()
    • L96 intent.putExtra(PENDINGPARCEL, holder.contentIntent) -> android.content.Intent.putExtra(java.lang.String, android.os.Parcelable)
    • L103 PendingIntent.getBroadcast(context, getPendingIntentCode(), intent, PendingIntent.FLAG_UPDATE_CURRENT) ERR Unable to calculate the type of a parameter of a method call. Method call: PendingIntent.getBroadcast(context, getPendingIntentCode(), intent, PendingIntent.FLAG_UPDATE_CURRENT), Parameter: PendingIntent.FLAG_UPDATE_CURRENT
    • L103 getPendingIntentCode() -> com.example.adorilson.testjavasymbolresolv.utility.NotifUtil.getPendingIntentCode()
    • L105 new NotificationCompat.Builder(context).setTicker(holder.tickerText).setWhen(System.currentTimeMillis()).setContentIntent(content).setDeleteIntent(delete).setContentText(holder.message).setAutoCancel(true) ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=new NotificationCompat.Builder(context).setTicker(holder.tickerText).setWhen(System.currentTimeMillis()).setContentIntent(content).setDeleteIntent(delete).setContentText(holder.message).setAutoCancel(true)}
    • L105 new NotificationCompat.Builder(context).setTicker(holder.tickerText).setWhen(System.currentTimeMillis()).setContentIntent(content).setDeleteIntent(delete).setContentText(holder.message) ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=new NotificationCompat.Builder(context).setTicker(holder.tickerText).setWhen(System.currentTimeMillis()).setContentIntent(content).setDeleteIntent(delete).setContentText(holder.message)}
    • L105 new NotificationCompat.Builder(context).setTicker(holder.tickerText).setWhen(System.currentTimeMillis()).setContentIntent(content).setDeleteIntent(delete) ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=new NotificationCompat.Builder(context).setTicker(holder.tickerText).setWhen(System.currentTimeMillis()).setContentIntent(content).setDeleteIntent(delete)}
    • L105 new NotificationCompat.Builder(context).setTicker(holder.tickerText).setWhen(System.currentTimeMillis()).setContentIntent(content) ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=new NotificationCompat.Builder(context).setTicker(holder.tickerText).setWhen(System.currentTimeMillis()).setContentIntent(content)}
    • L105 new NotificationCompat.Builder(context).setTicker(holder.tickerText).setWhen(System.currentTimeMillis()) ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=new NotificationCompat.Builder(context).setTicker(holder.tickerText).setWhen(System.currentTimeMillis())}
    • L105 new NotificationCompat.Builder(context).setTicker(holder.tickerText) ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=new NotificationCompat.Builder(context).setTicker(holder.tickerText)}
    • L107 System.currentTimeMillis() -> java.lang.System.currentTimeMillis()
    • L113 getStackSize() -> com.example.adorilson.testjavasymbolresolv.utility.NotifUtil.getStackSize()
    • L114 largeText(context, builder) ERR Unable to calculate the type of a parameter of a method call. Method call: largeText(context, builder), Parameter: builder
    • L121 builder.setStyle(new NotificationCompat.BigTextStyle().bigText(getNotificationsAsString())) ERR Unable to calculate the type of a parameter of a method call. Method call: builder.setStyle(new NotificationCompat.BigTextStyle().bigText(getNotificationsAsString())), Parameter: new NotificationCompat.BigTextStyle().bigText(getNotificationsAsString())
    • L121 new NotificationCompat.BigTextStyle().bigText(getNotificationsAsString()) ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=new NotificationCompat.BigTextStyle().bigText(getNotificationsAsString())}
    • L121 getNotificationsAsString() -> com.example.adorilson.testjavasymbolresolv.utility.NotifUtil.getNotificationsAsString()
    • L122 builder.setNumber(getStackSize()) ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=builder.setNumber(getStackSize())}
    • L122 getStackSize() -> com.example.adorilson.testjavasymbolresolv.utility.NotifUtil.getStackSize()
    • L129 out.append(holder.tickerText) -> java.lang.StringBuilder.append(java.lang.String)
    • L130 out.append(" - ") -> java.lang.StringBuilder.append(java.lang.String)
    • L131 out.append(holder.message) -> java.lang.StringBuilder.append(java.lang.String)
    • L132 out.append("\n") -> java.lang.StringBuilder.append(java.lang.String)
    • L138 getStackSize() -> com.example.adorilson.testjavasymbolresolv.utility.NotifUtil.getStackSize()
    • L139 clearStack() -> com.example.adorilson.testjavasymbolresolv.utility.NotifUtil.clearStack()
    • L142 _notifStack.get(1) -> java.util.ArrayList.get(int)
    • L143 _notifStack.remove(0) -> java.util.ArrayList.remove(int)
    • L147 context.getSystemService(Context.NOTIFICATION_SERVICE) ERR Unable to calculate the type of a parameter of a method call. Method call: context.getSystemService(Context.NOTIFICATION_SERVICE), Parameter: Context.NOTIFICATION_SERVICE
    • L149 nm.cancel(tag, id) -> android.app.NotificationManager.cancel(java.lang.String, int)
    • L153 cancel(context, VSHOW_TAG, id) -> com.example.adorilson.testjavasymbolresolv.utility.NotifUtil.cancel(android.content.Context, java.lang.String, int)
    • L157 in.getSSID() ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=in.getSSID()}
    • L158 in.setSSID(StatusMessage.EMPTY) ERR Unable to calculate the type of a parameter of a method call. Method call: in.setSSID(StatusMessage.EMPTY), Parameter: StatusMessage.EMPTY
    • L159 in.getStatus() ERR Issur calculating the type of the scope of MethodCallExprContext{wrapped=in.getStatus()}
    • L160 in.setStatus(StatusMessage.EMPTY) ERR Unable to calculate the type of a parameter of a method call. Method call: in.setStatus(StatusMessage.EMPTY), Parameter: StatusMessage.EMPTY
    • L165 showToast(context, context.getString(resID), Toast.LENGTH_LONG) ERR Unable to calculate the type of a parameter of a method call. Method call: showToast(context, context.getString(resID), Toast.LENGTH_LONG), Parameter: Toast.LENGTH_LONG
    • L165 context.getString(resID) -> android.content.Context.getString(int)
    • L169 showToast(context, message, Toast.LENGTH_LONG) ERR Unable to calculate the type of a parameter of a method call. Method call: showToast(context, message, Toast.LENGTH_LONG), Parameter: Toast.LENGTH_LONG
    • L173 showToast(context, context.getString(resID), delay) -> com.example.adorilson.testjavasymbolresolv.utility.NotifUtil.showToast(android.content.Context, java.lang.String, int)
    • L173 context.getString(resID) -> android.content.Context.getString(int)
    • L178 context.getSystemService(Service.LAYOUT_INFLATER_SERVICE) ERR Unable to calculate the type of a parameter of a method call. Method call: context.getSystemService(Service.LAYOUT_INFLATER_SERVICE), Parameter: Service.LAYOUT_INFLATER_SERVICE
    • L180 context.getApplicationContext() -> android.content.Context.getApplicationContext()
    • L181 toast.setGravity(Gravity.BOTTOM | Gravity.CENTER, 0, 0) ERR Unable to calculate the type of a parameter of a method call. Method call: toast.setGravity(Gravity.BOTTOM | Gravity.CENTER, 0, 0), Parameter: Gravity.BOTTOM | Gravity.CENTER
    • L182 toast.setDuration(delay) -> android.widget.Toast.setDuration(int)
    • L183 toast.show() -> android.widget.Toast.show()
    • L188 _notifStack.clear() -> java.util.ArrayList.clear() /home/adorilson/workspace/TestJavaSymbolResolv/app/src/main/java/com/example/adorilson/testjavasymbolresolv/utility/StringUtil.java
    • L23 ssid.endsWith(""") -> java.lang.String.endsWith(java.lang.String)
    • L23 ssid.startsWith(""") -> java.lang.String.startsWith(java.lang.String)
    • L25 ssid.substring(1, ssid.length() - 1) -> java.lang.String.substring(int, int)
    • L25 ssid.length() -> java.lang.String.length()
    • L35 s.substring(1, s.length() - 1) -> java.lang.String.substring(int, int)
    • L35 s.length() -> java.lang.String.length()
    • L43 capabilities.length() -> java.lang.String.length()
    • L50 capabilities.length() -> java.lang.String.length()
    • L52 capabilities.contains(WEP) -> java.lang.String.contains(java.lang.CharSequence)
    • L54 capabilities.contains(WPA2) -> java.lang.String.contains(java.lang.CharSequence)
    • L56 capabilities.contains(WPA) -> java.lang.String.contains(java.lang.CharSequence)
    • L58 capabilities.contains(WPS) -> java.lang.String.contains(java.lang.CharSequence) /home/adorilson/workspace/TestJavaSymbolResolv/app/src/main/java/com/example/adorilson/testjavasymbolresolv/SleepPolicyHelper.java
    • L17 cacheSelector() -> com.example.adorilson.testjavasymbolresolv.SleepPolicyHelper.cacheSelector()
    • L18 _selector.vGetSleepPolicy(context) -> com.example.adorilson.testjavasymbolresolv.SleepPolicyHelper.vGetSleepPolicy(android.content.Context)
    • L22 cacheSelector() -> com.example.adorilson.testjavasymbolresolv.SleepPolicyHelper.cacheSelector()
    • L23 _selector.vSetSleepPolicy(context, policy) -> com.example.adorilson.testjavasymbolresolv.SleepPolicyHelper.vSetSleepPolicy(android.content.Context, int) /home/adorilson/workspace/TestJavaSymbolResolv/app/build/generated/source/buildConfig/debug/com/example/adorilson/testjavasymbolresolv/BuildConfig.java
    • L7 Boolean.parseBoolean("true") -> java.lang.Boolean.parseBoolean(java.lang.String) solved 121 unsolved 0 errors 54

    Process finished with exit code 0`

    Sorry the big report.

    I'm using Ubuntu 14.04 LTS.

    bug 
    opened by adorilson 14
  • Analyze memory usage

    Analyze memory usage

    When moving to JP 3.2.8 the build on Travis failed because of out of memory issues. We moved from JP 3.2.4.

    Some tests that failed:

    An execution:

    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testGetAllAncestorsWithoutTypeParameters FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testGetAllSuperclassesWithoutTypeParameters FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testGetSuperclassWithTypeParameters FAILED
        java.lang.OutOfMemoryError at JavaParserClassDeclarationTest.java:171
    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testSolveMethodExisting FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testGetAllFields FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testGetSuperclassWithoutTypeParameters FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testGetDeclaredMethods FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testSolveMethodNotExisting FAILED
        java.lang.OutOfMemoryError
    Unexpected exception thrown.
    

    Another execution:

    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testGetAllAncestorsWithTypeParameters FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testIsClass FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.logic.FunctionInterfaceLogicTest > testGetFunctionalMethodPositiveCasesOnInterfaces FAILED
        java.lang.OutOfMemoryError at FunctionInterfaceLogicTest.java:49
    com.github.javaparser.symbolsolver.Issue186 > lambdaPrimitivesIssue FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.Issue186 > lambdaFlatMapIssue FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testAsInterface FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testAsClass FAILED
        java.lang.Exception
            Caused by: java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testGetPackageName FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testGetClassName FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testIsInterface FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testAsEnum FAILED
        java.lang.Exception
            Caused by: java.lang.OutOfMemoryError
    Unexpected exception thrown.
    java.lang.OutOfMemoryError: GC overhead limit exceeded
    

    Other one:

    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testGetAllAncestorsWithTypeParameters FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testIsClass FAILED
        java.lang.OutOfMemoryError at JavaParserClassDeclarationTest.java:88
    com.github.javaparser.symbolsolver.logic.FunctionInterfaceLogicTest > testGetFunctionalMethodNegativeCaseOnClass FAILED
        java.lang.InternalError at FunctionInterfaceLogicTest.java:38
            Caused by: java.lang.OutOfMemoryError at FunctionInterfaceLogicTest.java:38
    com.github.javaparser.symbolsolver.logic.FunctionInterfaceLogicTest > testGetFunctionalMethodPositiveCasesOnInterfaces FAILED
        java.lang.NoClassDefFoundError at FunctionInterfaceLogicTest.java:45
    com.github.javaparser.symbolsolver.Issue186 > lambdaPrimitivesIssue FAILED
        java.lang.NoClassDefFoundError at Issue186.java:45
    com.github.javaparser.symbolsolver.Issue186 > lambdaFlatMapIssue FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testAsInterface FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testAsClass FAILED
        java.lang.Exception
            Caused by: java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testGetPackageName FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testGetClassName FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testIsInterface FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testAsEnum FAILED
        java.lang.Exception
            Caused by: java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testGetQualifiedName FAILED
        java.lang.OutOfMemoryError
    

    other one:

    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testGetAllAncestorsWithTypeParameters FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testIsClass FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.logic.FunctionInterfaceLogicTest > testGetFunctionalMethodPositiveCasesOnInterfaces FAILED
        java.lang.OutOfMemoryError at FunctionInterfaceLogicTest.java:46
    com.github.javaparser.symbolsolver.Issue186 > lambdaPrimitivesIssue FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.Issue186 > lambdaFlatMapIssue FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testAsInterface FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistInterfaceDeclarationTest > testIsEnum FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javassistmodel.JavassistClassDeclarationTest > testGetAllSuperclassesWithTypeParameters FAILED
        java.lang.OutOfMemoryError
    Unexpected exception thrown.
    java.lang.OutOfMemoryError: GC overhead limit exceeded
    

    other one:

    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testGetAllAncestorsWithTypeParameters FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testIsClass FAILED
        java.lang.OutOfMemoryError at JavaParserClassDeclarationTest.java:88
    com.github.javaparser.symbolsolver.logic.FunctionInterfaceLogicTest > testGetFunctionalMethodPositiveCasesOnInterfaces FAILED
        java.lang.OutOfMemoryError at FunctionInterfaceLogicTest.java:48
    com.github.javaparser.symbolsolver.Issue186 > lambdaPrimitivesIssue FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.Issue186 > lambdaFlatMapIssue FAILED
    

    other one:

    m.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testGetAllAncestorsWithoutTypeParameters FAILED
        java.lang.OutOfMemoryError
    com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclarationTest > testGetAllSuperclassesWithoutTypeParameters FAILED
        java.lang.OutOfMemoryError
    
    enhancement 
    opened by ftomassetti 12
  • Class name of TypeParameter

    Class name of TypeParameter

    @ftomassetti: While you're in refactoring mode, I'd like to bring up a naming issue I've seen in the SymbolSolver codebase: Type parameters.

    Sometimes they are calles TypeParameter, sometimes just parameter, sometimes TypeVariable and I'm not totally sure but maybe I've also seen some code calling them actual and formal parameters. I think we should consistently stick to one path and call it TypeParameter and TypeArgument or call it FormalTypeParameter and ActualTypeParameter.

    I've been working with Clang a lot over the last three years and they call it parameter and argument and I think the Javaparser also uses this convention. What do you think?

    opened by mlangkabel 12
  • Issue80

    Issue80

    This is a work in progress on #80 .

    I would like to manually check the resolutions of method calls for the JavaParser code and verify it behaves as expected. It will need improvements because so far there are a few hundreds of method calls which cannot be solved (but over 5K that are solved).

    opened by ftomassetti 11
  • Find dependencies

    Find dependencies

    Hello, after reading quite a bit about javaparser and also trying a few things out, I am still not sure if the following is possible:

    ClassA { }

    ClassB{ ClassA.foo(); }

    Basically I want to know if ClassB is using ClassA or any other class for that matter. What I could do is check for the String classA.name inside classB, but I wouldnt need javaparser for that anyway(regex & BufferedReader are sufficient) + it is really inaccurate in some scenarios.

    Can I check for class usage in other classes using the actual objects to be 100% sure of usage?

    Thanks for any clarification

    question 
    opened by ghost 10
  • Get Declaration for Type

    Get Declaration for Type

    Today I've got another problem: Is it possible to fetch the com.github.javaparser.ast.body.ClassOrInterfaceDeclaration for a com.github.javaparser.ast.type.ClassOrInterfaceType?

    I've seen that the JavaParserFacade can be used to convert a Type and a Node to a TypeUsage (right now I don't know which node to pass to that method). Afterwards the TypeUsage can be used to get the type's declaration (which is a me.tomassetti.symbolsolver.model.declarations.TypeDeclaration). I guess the wrappedNode of this declaration is what I'm looking for, but in the current implementation of the Java Symbol Solver it is a private field. Is it possible to add a public getter for this field?

    The reason I need access to the AST node is type name resolution as discussed in #37.

    opened by mlangkabel 10
  • Implementation of getAncestors() in JavassistEnumDeclaration

    Implementation of getAncestors() in JavassistEnumDeclaration

    This PR implements the missing getAncestors() in JavassistEnumDeclaration and accessLevel() in JavassistConstructorDeclaration. getAncestors() only returns direct ancestors as written in the corresponding interface. java.lang.Enum is also added in the list as the only ancestor class of the enum.

    opened by loicfortin 9
  • Enums missing constructors and interfaces

    Enums missing constructors and interfaces

    Enums may have constructors and may implement interfaces. However, JavaParserConstructorDeclaration only allows ClassDeclaration to have a constructor and JavaParserEnumDeclaration does not currently have an API that gives access to the list of constructors or interfaces.

    feature high-priority 
    opened by tnterdan 9
  • Method call, acquire method body

    Method call, acquire method body

    Hello, I am new to parsing and currently using the javaparser library to parse method bodies in a java file, which works great. However, I would also like to fully resolve method calls to get a clear picture of the control flow. I am currently trying out the javasymbolsolver and I am able to access the method signature via reflection. I would also like to get the full method body of the called function and insert it into my syntax tree. For example here: public int absoluteLib(int num) { return Math.abs(num); } I would like to retrieve Math.abs(num) from java.lang.Math

        public static int abs(int a) {
            return (a < 0) ? -a : a;
        }
    

    and it to the body of my method.

    It seems that reflection in Java does not provide that functionality.

    Still, is there any way I could achieve this with the javasymbolsolver? If so, how?

    Thank you!

    Edit: Attached the current symbolsolver implementation

    class TypeCalculatorVisitor extends VoidVisitorAdapter<JavaParserFacade> {
    		@Override
    		public void visit(MethodCallExpr n, JavaParserFacade javaParserFacade) {
    			super.visit(n, javaParserFacade);
    			MethodDeclaration test = javaParserFacade.solve(n).getCorrespondingDeclaration();
    			System.out.println(n.toString() + " with signature " + test.getSignature());
    		}
    	}
    
    	public void processJavaFile(File inputFile) throws FileNotFoundException {
    		CombinedTypeSolver typeSolver = new CombinedTypeSolver(new JavaParserTypeSolver(new File("./reference"))); //includes .java files
    		typeSolver.add(new ReflectionTypeSolver());
    		CompilationUnit agendaCu = JavaParser.parse(inputFile);
    		agendaCu.accept(new TypeCalculatorVisitor(), JavaParserFacade.get(typeSolver));
    }
    
    opened by fruffy 9
Owner
JavaParser
JavaParser
Project on End to End CI/CD pipeline for java based application using Git,Github,Jenkins,Maven,Sonarqube,Nexus,Slack,Docker and Kuberenets with ECR as private docker registry and Zero Downtime Deployment

Project on End to End CI/CD pipeline for java based application using Git,Github,Jenkins,Maven,Sonarqube,Nexus,Slack,Docker and Kuberenets with ECR as private docker registry and Zero Downtime Deployment.

NITHIN JOHN GEORGE 10 Nov 22, 2022
Old and archived; More recent development is in https://github.com/Create-Fabric/Create-Refabricated.

NOW ARCHIVED Go here for the continuation of this project. Old README Create Fabric A Fabric port of Create. Create Discord: https://discord.gg/AjRTh6

null 12 Dec 7, 2022
Now redundant weka mirror. Visit https://github.com/Waikato/weka-trunk for the real deal

weka (mirror) Computing and Mathematical Sciences at the University of Waikato now has an official github organization including a read-only git mirro

Benjamin Petersen 313 Dec 16, 2022
old leak now public

binscure Usage: Import your build.gradle into Intellij as a "New > Project from existing sources" If you get a Java Home error, meaning that your Java

eth millionaire 56 Dec 2, 2022
Repository to keep up with ViaVersion on MCP (Originally from https://github.com/LaVache-FR/ViaMCP)

ViaMCP-Reborn Repository to keep up with ViaVersion on MCP (Originally from https://github.com/LaVache-FR/ViaMCP) 1.7.x Protocols Yes, i know they are

null 109 Dec 28, 2022
Eclipse Foundation 3k Dec 31, 2022
DEPRECATED: use https://github.com/jhipster/jhipster-bom instead

JHipster BOM and server-side library - DEPRECATED Full documentation and information is available on our website at https://www.jhipster.tech/ This pr

JHipster 407 Nov 29, 2022
Please visit https://github.com/h2oai/h2o-3 for latest H2O

Caution: H2O-3 is now the current H2O! Please visit https://github.com/h2oai/h2o-3 H2O H2O makes Hadoop do math! H2O scales statistics, machine learni

H2O.ai 2.2k Jan 6, 2023
A simple expressive web framework for java. Spark has a kotlin DSL https://github.com/perwendel/spark-kotlin

Spark - a tiny web framework for Java 8 Spark 2.9.3 is out!! Changeset <dependency> <groupId>com.sparkjava</groupId> <artifactId>spark-core</a

Per Wendel 9.4k Dec 29, 2022
Please visit https://github.com/h2oai/h2o-3 for latest H2O

Caution: H2O-3 is now the current H2O! Please visit https://github.com/h2oai/h2o-3 H2O H2O makes Hadoop do math! H2O scales statistics, machine learni

H2O.ai 2.2k Dec 9, 2022
Maven port of the Netflix Gradle code generation plugin for graphql. https://github.com/Netflix/dgs-codegen

This is port of the netflix codegen plugin for Gradle. Found here. COPIED FROM NETFLIX DOCUMENTATION. The DGS Code Generation plugin generates code fo

null 63 Dec 24, 2022
PS4 Remote PKG Installer GUI for https://github.com/flatz/ps4_remote_pkg_installer

PS4 Remote PKG Installer PS4 Remote PKG Installer GUI for https://github.com/flatz/ps4_remote_pkg_installer Tired of copying PKG files to USB then wal

Benjamin Faal 116 Dec 25, 2022
图书管理;图书管理系统;图书管理系统后端,该项目采用Springboot整合Mybatis对数据持久化以及Api的封装实现,前台项目地址:https://github.com/Nirunfeng/BookSys-Client

System of Book Management(sbm) 项目说明 图书管理系统后台,该项目采用Springboot整合Mybatis对数据持久化以及Api的封装实现,前台项目地址:BookSys-Client 项目启动 数据库:mysql5.6执行以下脚本,项目下脚本文件--sbm.sql 导

null 61 Dec 30, 2022
🕊️ The world's most advanced open source instant messaging engine for 100K~10M concurrent users https://turms-im.github.io/docs

简体中文 What is Turms Turms is the most advanced open-source instant messaging engine for 100K~10M concurrent users in the world. Please refer to Turms D

null 1.2k Dec 27, 2022
GitHub Search Engine: Web Application used to retrieve, store and present projects from GitHub, as well as any statistics related to them.

GHSearch Platform This project is made of two subprojects: application: The main application has two main responsibilities: Crawling GitHub and retrie

SEART - SoftwarE Analytics Research Team 68 Nov 25, 2022
GithubReleases4J - GitHub Releases for Java , based on GitHub RESTful API .

GithubReleases4J - GitHub Releases for Java , based on GitHub RESTful API .

Carm 5 Jun 27, 2022
The place to come for pair programming practice problems in your language, designed for new and old developers alike.

Coding Dojo About The Coding Dojo is a project and weekly meetup hosted by Code Connector to offer opportunities for learning, mentoring, and practici

Code Connector 55 Nov 18, 2022
Log4Shell RCE exploit using a gadget class. Not dependent on an old JDK version to work.

Log4Shell RCE exploit using a gadget class. Not dependent on an old JDK version to work.

null 8 Jan 4, 2022
Facelifting of old DesertWind game

Desert Wind Facelifting of old DesertWind game #Tech Frontend(UI) Angular Backend Java spring boot DB SQL(MySQL) CI GitHub CI pipeline? #Process Branc

null 4 Mar 18, 2022