Skip to content

Commit

Permalink
Preparing next release
Browse files Browse the repository at this point in the history
  • Loading branch information
vsilaev committed Feb 26, 2019
1 parent af2e295 commit dba2b87
Show file tree
Hide file tree
Showing 20 changed files with 165 additions and 123 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Maven Central](https://img.shields.io/maven-central/v/net.tascalate.javaflow/net.tascalate.javaflow.parent.svg)](https://search.maven.org/artifact/net.tascalate.javaflow/net.tascalate.javaflow.parent/2.5.0/pom) [![GitHub release](https://img.shields.io/github/release/vsilaev/tascalate-javaflow.svg)](https://github.com/vsilaev/tascalate-javaflow/releases/tag/2.5.0) [![license](https://img.shields.io/github/license/vsilaev/tascalate-javaflow.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt)
[![Maven Central](https://img.shields.io/maven-central/v/net.tascalate.javaflow/net.tascalate.javaflow.parent.svg)](https://search.maven.org/artifact/net.tascalate.javaflow/net.tascalate.javaflow.parent/2.6.0/pom) [![GitHub release](https://img.shields.io/github/release/vsilaev/tascalate-javaflow.svg)](https://github.com/vsilaev/tascalate-javaflow/releases/tag/2.6.0) [![license](https://img.shields.io/github/license/vsilaev/tascalate-javaflow.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt)

# IMPORTNAT NOTICE FOR RELEASE 2.5.0!!!
Java 9+ is fully supported now, all artefacts are modular multi-release JAR-s that works correctly with Java versions 1.6 to 11. The library code was tested with JDK 11, and all features of the Java 11 bytecode (including nest of inner classes) works correctly.
Expand Down Expand Up @@ -29,13 +29,13 @@ You have to add the following configuration to enable build-time instrumentation
<dependency>
<groupId>net.tascalate.javaflow</groupId>
<artifactId>net.tascalate.javaflow.api</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
</dependency>
<!-- Add-on for Java 8 and above -->
<dependency>
<groupId>net.tascalate.javaflow</groupId>
<artifactId>net.tascalate.javaflow.extras</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
</dependency>
...
</dependencies>
Expand All @@ -54,7 +54,7 @@ You have to add the following configuration to enable build-time instrumentation
<plugin>
<groupId>net.tascalate.javaflow</groupId>
<artifactId>net.tascalate.javaflow.tools.maven</artifactId>
<version>2.5.0</version>
<version>2.6.0</version>
<executions>
<execution>
<phase>process-classes</phase>
Expand All @@ -67,7 +67,7 @@ You have to add the following configuration to enable build-time instrumentation
</plugins>
</build>
```
Note that if you are using continuations with Java 1.8 lambdas then you need to add [Tascalate JavaFlow instrumentation agent](https://github.com/vsilaev/tascalate-javaflow/releases/download/2.5.0/javaflow.instrument-continuations.jar) at run-time as command-line option, while lambda-related classes are generated by JVM on the fly and there is no other way to instrument them. If this is not an option, then you can de-sugar all lambdas with [RetroLambda](https://github.com/luontola/retrolambda) Maven plugin at build-time (RetroLambda output is supported by Tascalate JavaFlow 2.3.2 or higher).
Note that if you are using continuations with Java 1.8 lambdas then you need to add [Tascalate JavaFlow instrumentation agent](https://github.com/vsilaev/tascalate-javaflow/releases/download/2.6.0/javaflow.instrument-continuations.jar) at run-time as command-line option, while lambda-related classes are generated by JVM on the fly and there is no other way to instrument them. If this is not an option, then you can de-sugar all lambdas with [RetroLambda](https://github.com/luontola/retrolambda) Maven plugin at build-time (RetroLambda output is supported by Tascalate JavaFlow 2.3.2 or higher).

Please refer to [pom.xml](https://github.com/vsilaev/tascalate-javaflow-examples/blob/master/net.tascalate.javaflow.examples.common/pom.xml) in examples project for typical Maven configuration

Expand Down Expand Up @@ -96,7 +96,7 @@ It's possibe to instrument compiled Java classes as below:
You may download a complete [examples project setup](https://github.com/vsilaev/tascalate-javaflow-examples/releases/download/1.0.0/tascalate-javaflow-ant-project-setup1.zip) from [the latest release](https://github.com/vsilaev/tascalate-javaflow-examples/releases/tag/1.0.0) for complete configuration template. Please pay attention to <code>ant-lib</code> folder with Ant TaskDef and <code>lib</code> folders with compile-/runtime-dependencies.

# Java Instrumentation Agent (Runt-time Instrumentation)
As an alternative to compile-time bytecode instrumentation, you MAY use [Tascalate JavaFlow Instrumentation Agent](https://github.com/vsilaev/tascalate-javaflow/releases/download/2.5.0/javaflow.instrument-continuations.jar) from [the latest release](https://github.com/vsilaev/tascalate-javaflow/releases/tag/2.5.0) to enable continuations support at class-loading time. Please note, that if you are using Java 8 and creating continuable lambda functions (either anonymous or/and as method references), and you don't replace them with tools like [RetroLambda](https://github.com/luontola/retrolambda) as mentioned above, then you SHOULD use this instrumentation agent always: as long as Java run-time generates implementation of functional interfaces on the fly there is no other option to instrument them. To enable Tascalate JavaFlow Instrumentation Agent please add the following arguments to Java command line:
As an alternative to compile-time bytecode instrumentation, you MAY use [Tascalate JavaFlow Instrumentation Agent](https://github.com/vsilaev/tascalate-javaflow/releases/download/2.6.0/javaflow.instrument-continuations.jar) from [the latest release](https://github.com/vsilaev/tascalate-javaflow/releases/tag/2.6.0) to enable continuations support at class-loading time. Please note, that if you are using Java 8 and creating continuable lambda functions (either anonymous or/and as method references), and you don't replace them with tools like [RetroLambda](https://github.com/luontola/retrolambda) as mentioned above, then you SHOULD use this instrumentation agent always: as long as Java run-time generates implementation of functional interfaces on the fly there is no other option to instrument them. To enable Tascalate JavaFlow Instrumentation Agent please add the following arguments to Java command line:
```bash
java -javaagent:<path-to-jar>/javaflow.instrument-continuations.jar <rest-of arguments>
```
Expand All @@ -113,7 +113,7 @@ It's possible to use a stand-alone command-line utility [JavaFlowRewriteJar.jar]
Note, that the source and the destination should be different files.

# CDI Support
To work correctly in CDI environment continuable methods should be advised only by continuation-aware CDI proxies (interceptors, scope proxies, etc). Obviously, generation of these proxies is out of our control. Plus, major CDI containers (JBoss Weld and Apache OpenWebBeans) generates such proxies dynamically at run-time. Therefore if you plan to use Tascalate JavaFlow continuations with managed beans' methods then it's necessary to instrument CDI-specific proxies with [javaflow.instrument-cdi-proxy.jar](https://github.com/vsilaev/tascalate-javaflow/releases/download/2.5.0/javaflow.instrument-cdi-proxy.jar) Java Agent:
To work correctly in CDI environment continuable methods should be advised only by continuation-aware CDI proxies (interceptors, scope proxies, etc). Obviously, generation of these proxies is out of our control. Plus, major CDI containers (JBoss Weld and Apache OpenWebBeans) generates such proxies dynamically at run-time. Therefore if you plan to use Tascalate JavaFlow continuations with managed beans' methods then it's necessary to instrument CDI-specific proxies with [javaflow.instrument-cdi-proxy.jar](https://github.com/vsilaev/tascalate-javaflow/releases/download/2.6.0/javaflow.instrument-cdi-proxy.jar) Java Agent:
```bash
java -javaagent:<path-to-jar>/javaflow.instrument-cdi-proxy.jar <rest-of arguments>
```
Expand Down
2 changes: 1 addition & 1 deletion net.tascalate.javaflow.api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>net.tascalate.javaflow</groupId>
<artifactId>net.tascalate.javaflow.parent</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.0</version>
<relativePath>../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion net.tascalate.javaflow.providers.asm3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>net.tascalate.javaflow</groupId>
<artifactId>net.tascalate.javaflow.parent</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.0</version>
<relativePath>../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion net.tascalate.javaflow.providers.asm4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>net.tascalate.javaflow</groupId>
<artifactId>net.tascalate.javaflow.parent</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.0</version>
<relativePath>../</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package org.apache.commons.javaflow.providers.asm4;

import java.io.IOException;

import org.apache.commons.javaflow.spi.Cache;
import org.apache.commons.javaflow.spi.ClassMatcher;
import org.apache.commons.javaflow.spi.ClassMatchers;
import org.apache.commons.javaflow.spi.ResourceLoader;
import org.apache.commons.javaflow.spi.ResourceTransformationFactory;
import org.apache.commons.javaflow.spi.ResourceTransformer;
import org.apache.commons.javaflow.spi.VetoableResourceLoader;

import org.objectweb.asm.ClassReader;

public abstract class AbstractResourceTransformationFactory implements ResourceTransformationFactory {

public ResourceTransformer createTransformer(ResourceLoader resourceLoader) {
SharedContinuableClassInfos cciShared = CACHED_SHARED_CCI.get(resourceLoader);
return createTransformer(
resourceLoader,
new IContinuableClassInfoResolver(resourceLoader, cciShared),
// Actualize ClassHierarchy per resource loader
cciShared.hierarchy().shareWith(resourceLoader)
);
}

abstract protected ResourceTransformer createTransformer(ResourceLoader resourceLoader,
ContinuableClassInfoResolver resolver,
ClassHierarchy classHierarchy);

public ContinuableClassInfoResolver createResolver(ResourceLoader resourceLoader) {
return new IContinuableClassInfoResolver(
resourceLoader,
CACHED_SHARED_CCI.get(resourceLoader)
);
}

public String readClassName(byte[] classBytes) {
return new ClassReader(classBytes).getClassName();
}

static ClassMatcher createVeto(ResourceLoader resourceLoader) {
if (resourceLoader instanceof VetoableResourceLoader) {
try {
return ((VetoableResourceLoader)resourceLoader).createVeto();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} else {
return ClassMatchers.MATCH_NONE;
}
}

private static final Cache<ResourceLoader, SharedContinuableClassInfos> CACHED_SHARED_CCI =
new Cache<ResourceLoader, SharedContinuableClassInfos>() {
@Override
protected SharedContinuableClassInfos createValue(ResourceLoader loader) {
return new SharedContinuableClassInfos(
new ClassHierarchy(loader), createVeto(loader)
);
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,60 +15,16 @@
*/
package org.apache.commons.javaflow.providers.asm4;

import java.io.IOException;

import org.apache.commons.javaflow.spi.Cache;
import org.apache.commons.javaflow.spi.ClassMatcher;
import org.apache.commons.javaflow.spi.ClassMatchers;
import org.apache.commons.javaflow.spi.ResourceLoader;
import org.apache.commons.javaflow.spi.ResourceTransformationFactory;
import org.apache.commons.javaflow.spi.ResourceTransformer;
import org.apache.commons.javaflow.spi.VetoableResourceLoader;

import org.objectweb.asm.ClassReader;

public class Asm4ResourceTransformationFactory implements ResourceTransformationFactory {

public ResourceTransformer createTransformer(ResourceLoader resourceLoader) {
SharedContinuableClassInfos cciShared = CACHED_SHARED_CCI.get(resourceLoader);
return new ContinuableClassTransformer(
// Actualize ClassHierarchy per resource loader
cciShared.hierarchy().shareWith(resourceLoader),
new IContinuableClassInfoResolver(resourceLoader, cciShared)
);
}

public ContinuableClassInfoResolver createResolver(ResourceLoader resourceLoader) {
return new IContinuableClassInfoResolver(
resourceLoader,
CACHED_SHARED_CCI.get(resourceLoader)
);
}

public String readClassName(byte[] classBytes) {
return new ClassReader(classBytes).getClassName();
}
public class Asm4ResourceTransformationFactory extends AbstractResourceTransformationFactory {

static ClassMatcher createVeto(ResourceLoader resourceLoader) {
if (resourceLoader instanceof VetoableResourceLoader) {
try {
return ((VetoableResourceLoader)resourceLoader).createVeto();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} else {
return ClassMatchers.MATCH_NONE;
}
protected ResourceTransformer createTransformer(ResourceLoader resourceLoader,
ContinuableClassInfoResolver resolver,
ClassHierarchy classHierarchy) {

return new ContinuableClassTransformer(classHierarchy, (IContinuableClassInfoResolver)resolver);
}

private static final Cache<ResourceLoader, SharedContinuableClassInfos> CACHED_SHARED_CCI =
new Cache<ResourceLoader, SharedContinuableClassInfos>() {
@Override
protected SharedContinuableClassInfos createValue(ResourceLoader loader) {
return new SharedContinuableClassInfos(
new ClassHierarchy(loader), createVeto(loader)
);
}
};

}
2 changes: 1 addition & 1 deletion net.tascalate.javaflow.providers.asm5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>net.tascalate.javaflow</groupId>
<artifactId>net.tascalate.javaflow.parent</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.0</version>
<relativePath>../</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package org.apache.commons.javaflow.providers.asm5;

import java.io.IOException;

import org.apache.commons.javaflow.spi.Cache;
import org.apache.commons.javaflow.spi.ClassMatcher;
import org.apache.commons.javaflow.spi.ClassMatchers;
import org.apache.commons.javaflow.spi.ResourceLoader;
import org.apache.commons.javaflow.spi.ResourceTransformationFactory;
import org.apache.commons.javaflow.spi.ResourceTransformer;
import org.apache.commons.javaflow.spi.VetoableResourceLoader;

import org.objectweb.asm.ClassReader;

public abstract class AbstractResourceTransformationFactory implements ResourceTransformationFactory {

public ResourceTransformer createTransformer(ResourceLoader resourceLoader) {
SharedContinuableClassInfos cciShared = CACHED_SHARED_CCI.get(resourceLoader);
return createTransformer(
resourceLoader,
new IContinuableClassInfoResolver(resourceLoader, cciShared),
// Actualize ClassHierarchy per resource loader
cciShared.hierarchy().shareWith(resourceLoader)
);
}

abstract protected ResourceTransformer createTransformer(ResourceLoader resourceLoader,
ContinuableClassInfoResolver resolver,
ClassHierarchy classHierarchy);

public ContinuableClassInfoResolver createResolver(ResourceLoader resourceLoader) {
return new IContinuableClassInfoResolver(
resourceLoader,
CACHED_SHARED_CCI.get(resourceLoader)
);
}

public String readClassName(byte[] classBytes) {
return new ClassReader(classBytes).getClassName();
}

static ClassMatcher createVeto(ResourceLoader resourceLoader) {
if (resourceLoader instanceof VetoableResourceLoader) {
try {
return ((VetoableResourceLoader)resourceLoader).createVeto();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} else {
return ClassMatchers.MATCH_NONE;
}
}

private static final Cache<ResourceLoader, SharedContinuableClassInfos> CACHED_SHARED_CCI =
new Cache<ResourceLoader, SharedContinuableClassInfos>() {
@Override
protected SharedContinuableClassInfos createValue(ResourceLoader loader) {
return new SharedContinuableClassInfos(
new ClassHierarchy(loader), createVeto(loader)
);
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,60 +15,16 @@
*/
package org.apache.commons.javaflow.providers.asm5;

import java.io.IOException;

import org.apache.commons.javaflow.spi.Cache;
import org.apache.commons.javaflow.spi.ClassMatcher;
import org.apache.commons.javaflow.spi.ClassMatchers;
import org.apache.commons.javaflow.spi.ResourceLoader;
import org.apache.commons.javaflow.spi.ResourceTransformationFactory;
import org.apache.commons.javaflow.spi.ResourceTransformer;
import org.apache.commons.javaflow.spi.VetoableResourceLoader;

import org.objectweb.asm.ClassReader;

public class Asm5ResourceTransformationFactory implements ResourceTransformationFactory {

public ResourceTransformer createTransformer(ResourceLoader resourceLoader) {
SharedContinuableClassInfos cciShared = CACHED_SHARED_CCI.get(resourceLoader);
return new ContinuableClassTransformer(
// Actualize ClassHierarchy per resource loader
cciShared.hierarchy().shareWith(resourceLoader),
new IContinuableClassInfoResolver(resourceLoader, cciShared)
);
}

public ContinuableClassInfoResolver createResolver(ResourceLoader resourceLoader) {
return new IContinuableClassInfoResolver(
resourceLoader,
CACHED_SHARED_CCI.get(resourceLoader)
);
}

public String readClassName(byte[] classBytes) {
return new ClassReader(classBytes).getClassName();
}
public class Asm5ResourceTransformationFactory extends AbstractResourceTransformationFactory {

static ClassMatcher createVeto(ResourceLoader resourceLoader) {
if (resourceLoader instanceof VetoableResourceLoader) {
try {
return ((VetoableResourceLoader)resourceLoader).createVeto();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} else {
return ClassMatchers.MATCH_NONE;
}
protected ResourceTransformer createTransformer(ResourceLoader resourceLoader,
ContinuableClassInfoResolver resolver,
ClassHierarchy classHierarchy) {

return new ContinuableClassTransformer(classHierarchy, (IContinuableClassInfoResolver)resolver);
}

private static final Cache<ResourceLoader, SharedContinuableClassInfos> CACHED_SHARED_CCI =
new Cache<ResourceLoader, SharedContinuableClassInfos>() {
@Override
protected SharedContinuableClassInfos createValue(ResourceLoader loader) {
return new SharedContinuableClassInfos(
new ClassHierarchy(loader), createVeto(loader)
);
}
};

}
2 changes: 1 addition & 1 deletion net.tascalate.javaflow.providers.asmx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>net.tascalate.javaflow</groupId>
<artifactId>net.tascalate.javaflow.parent</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.0</version>
<relativePath>../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion net.tascalate.javaflow.spi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>net.tascalate.javaflow</groupId>
<artifactId>net.tascalate.javaflow.parent</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.0</version>
<relativePath>../</relativePath>
</parent>

Expand Down
Loading

0 comments on commit dba2b87

Please sign in to comment.