Comments (2)
For sure there are automated ways to get Kotlin files from Java files, maybe also the opposite is true.
JavaParser.parse(file)
parse the given file and give me a CompilationUnit, i.e., the root of the AST- Here you can find the definition of the extension method
descendantsOfType
for Node. It is basically a method for Node defined outside the Node class https://github.com/loren138/code-search-parser/blob/d69424779425019a6b884d4f8d1915219703f43a/src/main/kotlin/Utils.kt I use that to find all the instances of the class MethodCallExpr in the AST (MethodCallExpr in Kotlin = MethodCallExpr.class in java) - I cycle on the list of method calls executing a lambda on each of them. So each method is assigned to the lambda variable
it
and then the lambda code is executed
Is the rest clear?
It is true that using Kotlin is reducing the number of readers who can understand the example.
On the other hand it is so much better than Java...
from java-symbol-solver-examples.
Thanks, I was mostly having trouble translating the descendantsOfType function from Kotlin to something that was workable in Java, but I got it working this morning. I've added a pull request if you want to have the java edition available. #3
from java-symbol-solver-examples.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java-symbol-solver-examples.