GithubHelp home page GithubHelp logo

isabella232 / redprecursor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from echocat/redprecursor

0.0 0.0 0.0 372 KB

Access and modify your code before it will be transformed to bytecode by the compiler without AspectJ.

Home Page: https://redprecursor.echocat.org

Java 100.00%

redprecursor's Introduction

echocat RedPrecursor

The initial focus was to create a DBC-framework without the requirement of an Java-Agent or AspectJ. The result is a Annoation Processor for javac which get the parsed node tree after the evaluation of the compiler, could parse and modify it befor it will be transformed to the class bytecode.

Usage

You can use all normal annotations of JSR-305 and more anntations in org.echocat.redprecursor.annotations like GreaterThan, GreaterThanOrEqualTo, MatchesPattern, …

Examples

public void takeString(@Nonnull String toPrint) {
    System.out.println(toPrint);
}
...
takeString("Hello world!"); // Will print on the console Hello world!
takeString(null); // Will throw "NullPointerException: toPrint is null" 
@Nonnull public String integerToString(@Nonnegative int numberForString) {
    return Integer.toString(numberForString);
}
...
integerToString(666); // Will return "666"
integerToString(-666); // Will throw "IllegalArgumentException: numberForString is not greater than or equal to zero." 
@Nonnull public String getSomeString(boolean allowedToReturnSomeString) {
    return allowedToReturnSomeString ? "Hello world!" : null;
}
...
getSomeString(true); // Will return "Hello world!"
getSomeString(false); // Will throw "NullPointerException: The return value of getSomeString(..) is null" 

More?

Try the power out! ;-)

If you have more ideas open an issue or write us: [email protected]

Links

Integrate

Generally you does not need a separate compiler, another tool, do not have to include a complex build mechanism or something else. You just have to add the compilerplugin to your classpath while compile of your application and bundle one of the runtimes with your application to make this library work. – Not more – Really!

with Maven

<repositories>
    <repository>
        <id>echocat</id>
        <url>http://repo.echocat.org/echocat</url>
        <!-- We need currently this settings because we
             only have a snapshot release currently packed. -->
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
           <enabled>true</enabled>
           <updatePolicy>always</updatePolicy>
        </snapshots>
    </repository>
</repositories>

<dependencies>
    <!-- Choose this artifact if you just use the basic annotations. -->
    <dependency>
        <groupId>org.echocat.reprecursor</groupId>
        <artifactId>runtime</artifactId>
        <version>0.1.0-SNAPSHOT</version>
        <!-- This is already included by the compilerplugin. -->
        <scope>runtime</scope>
    </dependency>
    <!-- Choose this artifact if you use the basic and advanced annotations. -->
    <dependency>
        <groupId>org.echocat.reprecursor</groupId>
        <artifactId>advancedruntime</artifactId>
        <version>0.1.0-SNAPSHOT</version>
        <!-- This is already included by the compilerplugin. -->
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.echocat.reprecursor</groupId>
        <artifactId>compilerplugin</artifactId>
        <version>0.1.0-SNAPSHOT</version>
        <!-- We only want this jar to be available untile the compilation.
             Because this artifact contains the plugin for the javac. -->
        <scope>provided</scope>
    </dependency>
</dependencies>

Standalone

  • runtime.jar – Bundle it with your application to make javax.annotation and org.echocat.redprecursor.annotations available.
  • advancedruntime-bundled.jar – Bundle it with your application to make javax.annotation and org.echocat.redprecursor.annotations (including the advanced annoations) available.
  • compilerplugin-bundled.jar – Include this jar in the classpath while compile of your application. IMPORTANT: Do not bunlde it with your application.

Status

Currently the development status is ALPHA.

We currently test this code already with big production code of another closed source application but we develop this project with clearly defined coding conventions that make it be that your compiler plugin does not work with really all java code. Help us – test it with your code!

The danger does not belong to the compiled classes it primary belongs to the compilation process.

License

echocat RedPrecursor is licensed under MPL 2.0.

redprecursor's People

Contributors

blaubaer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.