question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[PiranhaJava] Integrate piranha to our microservice

See original GitHub issue

We are working on integrating piranha to our micro-service. we followed the steps mentioned in the Readme file. We are using lombok in our service. When we ran the build, below error is observed.

Stack Trace:

`[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project qb-billing-service-app: Compilation failure

[ERROR] /Users/ssathyamurthy/dev/qb-billing-service/app/src/main/java/com/intuit/billingcomm/billing/integration/IAMTicketClientIntegration.java:[76,42] error: An unhandled exception was thrown by the Error Prone static analysis plugin.

[ERROR] Please report this at https://github.com/google/error-prone/issues/new and include the following: [ERROR]
[ERROR] error-prone version: 2.4.0 [ERROR] BugPattern: Piranha [ERROR] Stack Trace: [ERROR] java.lang.ClassCastException: com.sun.tools.javac.tree.JCTree$JCBinary cannot be cast to com.sun.source.tree.ParenthesizedTree [ERROR] at com.uber.piranha.XPFlagCleaner.matchIf(XPFlagCleaner.java:1021) [ERROR] at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:451) [ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitIf(ErrorProneScanner.java:655) [ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitIf(ErrorProneScanner.java:152) [ERROR] at com.sun.tools.javac.tree.JCTree$JCIf.accept(JCTree.java:1427) [ERROR] at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82) [ERROR] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74) [ERROR] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48) [ERROR] at com.sun.source.util.TreeScanner.scan(TreeScanner.java:105) [ERROR] at com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:248) [ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:522) [ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:152) [ERROR] at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026) [ERROR] at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82) [ERROR] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74) [ERROR] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48) [ERROR] at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90) [ERROR] at com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:206) [ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:742) [ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:152) [ERROR] at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:898) [ERROR] at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82) [ERROR] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74) [ERROR] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48) [ERROR] at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90) [ERROR] at com.sun.source.util.TreeScanner.scan(TreeScanner.java:105) [ERROR] at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:113) [ERROR] at com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:187) [ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:550) [ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:152) [ERROR] at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:808) [ERROR] at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82) [ERROR] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74) [ERROR] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48) [ERROR] at com.sun.source.util.TreeScanner.scan(TreeScanner.java:105) [ERROR] at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:113) [ERROR] at com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:144) [ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:562) [ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:152) [ERROR] at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:591) [ERROR] at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:56) [ERROR] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:58) [ERROR] at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43) [ERROR] at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:152) [ERROR] at com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:120) [ERROR] at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1404) [ERROR] at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1353) [ERROR] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946) [ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:302) [ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:162) [ERROR] at com.sun.tools.javac.Main.compile(Main.java:57) [ERROR] at com.sun.tools.javac.Main.main(Main.java:43) [ERROR] `

Our Code where this issue in seen @Override public @NonNull IAMTicket createAndRenewOfflineTicket(@NonNull String realmID) throws IAMTicketClientException {

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
krmahadevancommented, Jun 6, 2022

@ketkarameya - That’s nice 👍 I was dreading that I had to learn the rudiments of rust (Yet another programming language 😄 )… to be able to build the binary. But good to know that you folks are on top of that as well.

I will give this a shot at my end and see if I can get past my problem. Please bear with me if I keep coming back with some really silly questions until then. The notion of AST and tree-sitter are all new to me and a bit overwhelming as well 😃 and now have been added to the never ending list of things that I need to still figure out… 😃

Lastly… this is a fantastic library that you folks have built. I loved the engineering blog that was created for Piranha!! Awesome engineering stuff!!!

2reactions
lazaroclappcommented, Oct 28, 2020

Lombok modifies the AST in memory during compilation, causing a number of issues when Error Prone tries to associate AST nodes back to the corresponding source code. In this case, it’s almost certain that Lombok is adding a conditional to the AST that doesn’t exist in the source, and there is something in that conditional that Piranha is trying to report/delete. Unfortunately, since the conditional itself doesn’t exist in the code, it can’t be reported on or deleted.

In general, there is no reasonable way to make Piranha refactor code that was injected by Lombok. Our best bet would be to:

  1. Require lombok.addLombokGeneratedAnnotation = true as part to the Lombok configuration
  2. Modify Piranha to skip syntactic scopes (e.g. methods, classes), marked as @lombok.Generated

That will still sometimes fail to clean up flag usages inside java classes that use Lombok (since Lombok can move user code and nest it inside its own generated structures), but it will avoid an outright compiler crash. Doing any better than that would require encoding knowledge of (potentially many) relevant Lombok transformations inside Piranha.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[PiranhaJava] Update sample project to show option ... - GitHub
In the past we have made PR's to Piranha to support additional usage patterns. While integrating Piranha with multiple java micro services ...
Read more >
Piranha | cloud
Piranha is a cloud native extensible runtime, which delivers various integration libraries facilitating running applications in a non application server ...
Read more >
Top 10 Feature Flags Projects on GitHub - Flagship.io
We've listed the top 10 open-source projects for feature flags on GitHub. View the ranking. ... piranha Java Created by uberStar.
Read more >
Introducing Piranha: An Open Source Tool to Automatically ...
Introducing Piranha: An Open Source Tool to Automatically Delete Stale Code · At Uber, we use feature flags to customize our mobile app...
Read more >
Pranav Bijapur - Graduate Research Assistant - Linkedin
I'm specialising in Distributed Systems at CMU and actively looking for Software Engineering roles in Systems starting December 2022.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found