Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Additional resource parsing (WIP)#790

fabapp2 started this conversation inIdeas
Discussion options

Currently, it is possible to define specialized resources,EjbJarXml is an example.
These resources might not use the parsing result created by OpenRewrite but a custom representation like a JAXB-generated object model.

Current implementation

  • ProjectContextInitializer scans the given project dir
  • The scanned resources are parsed byMavenProjectParser and wrapped inRewriteSourceFileHoldes
  • TheRewriteSourceFileHoldes are added to theProjectResourceSet
  • ProjectContextInitializer then callsapplyProjectResourceWrappers(ProjectResourceSet)
  • Another loop over all resources inProjectResourceSet trying to find a matchingProjectResourceWrapper to replaceRewriteSourceFileHolder with a more "speciaized resource", e.g.EjbJarXml (which inherits fromRewriteSourceFileHolder)

Problems with this implementation

  • All resources get parsed by OpenRewrite (currently inMavenProjectParser) and in case aProjectResourceWrapper is found it "parses" the resource again, e.g. by parsing the XML file with JAXB. => All specialized resources are parsed twice
  • Because of this implementation two models of a resource exist in parallel. In the given example OpenRewrite created anXml.Document after parsing the JAXB model representation is kept in a separate variable. => This allows for concurrent modifications and wastes memory
  • Some specialized resources might require access to other resources, e.g. Java classes to provide a complete API. Think of a representation ofSpringBootRestController
You must be logged in to vote

Replies: 0 comments

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Ideas
Labels
None yet
1 participant
@fabapp2

[8]ページ先頭

©2009-2025 Movatter.jp