Comments (4)
I love the graphviz idea. Maybe at some point in the future we have some kind of visual UI for creating or viewing rewrite recipes...
from rewrite.
Might suggest Graphviz's dot
output format instead of a proprietary one. Graphviz Java implementation.
- Unclear at this point whether it's best to dedup on common
J.Ident
or not. If we do, oft-repeatedJ.Idents
could be edge dense. - Does placing an
index=n
for indices of elements of a statement lists help rendering?
from rewrite.
Another future enhancement idea... Does bracketing the thing we care about, and pruning the tree to only the ancestors of that thing help?
public class A {
class B {
public void method() {
m1();
<<m2();>>
logger.info("log something");
}
}
}
Could be implemented relatively easily by string replacing with a marker comment before parsing like this:
```java
public class A {
class B {
public void method() {
m1();
/*PLOTME*/m2();
logger.info("log something");
}
}
}
...and then implementing a visitor that simply looks for any tree element with a formatting prefix containing /*PLOTME*/
, and plot everything in its cursor hierarchy.
Although, there is ambiguity in these statements, which both yield /*PLOTME*/a.m2()
prior to parsing:
<<a.m2()>> // the J.MethodInvocation
<<a.m2>>() // the name J.Ident
The cursor path is always a single line, so the graphviz representation doesn't help, and perhaps we only represent relatively shallow properties. In the above example, something like:
J.CompilationUnit{sourceFile=src/main/java/...}
J.ClassDecl{name=a.A}
J.ClassDecl{name=a.A.B}
J.MethodDecl{name=method, arguments = []}
J.MethodInvocation{receiver=a.A, name=m2, arguments = []}
from rewrite.
Good digraph examples including tags, in this case of Huffman encoding, but could be similar for our trees:
from rewrite.
Related Issues (20)
- GroovyParser issue with statically imported constants HOT 2
- GroovyParser issue with variable assignment using Map HOT 3
- org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods ignores class level @SuppressWarnings("unused")
- Gradle Plugin/Openrewrite should skip files anntoated with javax.annotation.Generated HOT 3
- 🐛 null is not an object (evaluating 'u.upgradesAndMigrations.map') HOT 2
- MavenPomDownloader - UncheckedIOException does not get wrapped into MavenDownloadingException HOT 1
- XPathMatcher doesn't find the path in the XML document if searched with tag attribute and hence changeTagValue recipe doesn't work as expected. HOT 2
- Option to enable recipes to leave a comment indicating auto-generated code HOT 1
- Expand getCoordinates of newClass to access arguments HOT 1
- Issue discovered on `docs/spring-authorization-server-docs.gradle` with `Change Gradle dependency artifact` HOT 1
- AppendToTextFile doesn't support newline-separated values? HOT 7
- StackOverflowError on attempt to run against import dependencies HOT 2
- add gradle dependency when using spring boot dependency management HOT 2
- Repository warnings when updating HOT 21
- Space is missing when adding annotation to variable declarations HOT 1
- Groovy parsing Exception while reading jenkins file - running custom recipe HOT 1
- XPathMatcher does not support paths containing "//" and conditions HOT 3
- OpenRewrite attempting to access java.net HOT 1
- Null properties being added to maven projects when using org.openrewrite.maven.UpgradeParentVersion HOT 2
- Invalid pattern for dependenciesFromResources in JavaParser
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 rewrite.