Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/int128/inspect-singleton-bean-thread-safety
Inspector of thread safety for singleton beans
https://github.com/int128/inspect-singleton-bean-thread-safety
code-analysis java java-parser
Last synced: about 1 month ago
JSON representation
Inspector of thread safety for singleton beans
- Host: GitHub
- URL: https://github.com/int128/inspect-singleton-bean-thread-safety
- Owner: int128
- License: apache-2.0
- Created: 2017-08-15T06:38:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-04T12:38:44.000Z (over 4 years ago)
- Last Synced: 2024-10-27T07:50:04.786Z (3 months ago)
- Topics: code-analysis, java, java-parser
- Language: Groovy
- Homepage:
- Size: 55.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Extract Fields in Java Sources
This is an example of parsing Java sources and extracting fields using [Java Parser](https://github.com/javaparser/javaparser).
## Getting Started
Just run the task.
```bash
./gradlew run -PbasePath=directory
```For instance, result on sources in [Effective Java Examples](https://github.com/marhan/effective-java-examples) may following:
```
$ ./gradlew run -PbasePath=../effective-java-examples
:compileJava NO-SOURCE
:compileGroovy
:processResources NO-SOURCE
:classes
:run
src\main\java\org\effectivejava\examples\chapter02\item02\builder\NutritionFacts.java,L5,NutritionFacts,private final int servingSize;
src\main\java\org\effectivejava\examples\chapter02\item02\builder\NutritionFacts.java,L6,NutritionFacts,private final int servings;
src\main\java\org\effectivejava\examples\chapter02\item02\builder\NutritionFacts.java,L7,NutritionFacts,private final int calories;
src\main\java\org\effectivejava\examples\chapter02\item02\builder\NutritionFacts.java,L8,NutritionFacts,private final int fat;
src\main\java\org\effectivejava\examples\chapter02\item02\builder\NutritionFacts.java,L9,NutritionFacts,private final int sodium;
src\main\java\org\effectivejava\examples\chapter02\item02\builder\NutritionFacts.java,L10,NutritionFacts,private final int carbohydrate;
src\main\java\org\effectivejava\examples\chapter02\item02\builder\NutritionFacts.java,L14,Builder,// Required parameters private final int servingSize;
src\main\java\org\effectivejava\examples\chapter02\item02\builder\NutritionFacts.java,L15,Builder,private final int servings;
src\main\java\org\effectivejava\examples\chapter02\item02\builder\NutritionFacts.java,L18,Builder,// Optional parameters - initialized to default values private int calories = 0;
src\main\java\org\effectivejava\examples\chapter02\item02\builder\NutritionFacts.java,L19,Builder,private int fat = 0;
src\main\java\org\effectivejava\examples\chapter02\item02\builder\NutritionFacts.java,L20,Builder,private int carbohydrate = 0;
src\main\java\org\effectivejava\examples\chapter02\item02\builder\NutritionFacts.java,L21,Builder,private int sodium = 0;
src\main\java\org\effectivejava\examples\chapter02\item02\javabeans\NutritionFacts.java,L6,NutritionFacts,// Parameters initialized to default values (if any) // Required; no default value private int servingSize = -1;...snip...
```## How works
See [Main.groovy](src/main/groovy/Main.groovy) for details.