Skip to content

Commit 84ea65a

Browse files
author
vsilaev
committed
Fix formatting
1 parent 94e5a66 commit 84ea65a

File tree

13 files changed

+110
-108
lines changed

13 files changed

+110
-108
lines changed

net.tascalate.javaflow.extras/src/main/java/org/apache/commons/javaflow/extras/CoIterator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class CoIterator<T> implements Iterator<T>, Serializable, AutoCloseable {
5757
* Continuable code that yields multiple results via call to
5858
* {@link Continuation#suspend(Object)}
5959
*/
60-
public CoIterator(final Runnable code) {
60+
public CoIterator(Runnable code) {
6161
cc = Continuation.startSuspendedWith(code);
6262
advance = true;
6363
}
@@ -69,7 +69,7 @@ public CoIterator(final Runnable code) {
6969
* {@link ContinuableRunnable} code that yields multiple results via call to
7070
* {@link Continuation#suspend(Object)}
7171
*/
72-
public CoIterator(final ContinuableRunnable code) {
72+
public CoIterator(ContinuableRunnable code) {
7373
this(ContinuationSupport.toRunnable(code));
7474
}
7575

@@ -81,7 +81,7 @@ public CoIterator(final ContinuableRunnable code) {
8181
* Valued returned by this iterator will be results these are yielded via call to
8282
* {@link Continuation#suspend(Object)}, i.e. cc.value() is not included
8383
*/
84-
public CoIterator(final Continuation cc) {
84+
public CoIterator(Continuation cc) {
8585
this.cc = cc;
8686
advance = true;
8787
}
@@ -98,7 +98,7 @@ public T next() {
9898
throw new NoSuchElementException();
9999

100100
@SuppressWarnings("unchecked")
101-
final T result = (T) cc.value();
101+
T result = (T) cc.value();
102102
advance = true;
103103

104104
return result;

net.tascalate.javaflow.extras/src/main/java/org/apache/commons/javaflow/extras/ContinuationSupport.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
import org.apache.commons.javaflow.api.continuable;
66

77
final class ContinuationSupport {
8-
private ContinuationSupport() {}
9-
8+
private ContinuationSupport() {
9+
}
1010

11-
static Runnable toRunnable(final ContinuableRunnable code) {
11+
static Runnable toRunnable(ContinuableRunnable code) {
1212
@SuppressWarnings("serial")
1313
abstract class ContinuableRunnableAdapter implements Runnable, Serializable {
1414
}

net.tascalate.javaflow.extras/src/main/java/org/apache/commons/javaflow/extras/Continuations.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626

2727
final public class Continuations {
2828

29-
private Continuations() {
30-
}
29+
private Continuations() {}
3130

3231
/**
3332
* Creates a suspended continuation, {@link ContinuableRunnable} is not started

net.tascalate.javaflow.spi/src/main/java/org/apache/commons/javaflow/spi/ClasspathResourceLoader.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,17 @@
2828

2929
public class ClasspathResourceLoader implements ResourceLoader {
3030

31-
final private ClassLoader classLoader;
32-
33-
public ClasspathResourceLoader(final ClassLoader classLoader) {
34-
this.classLoader = classLoader;
35-
}
36-
37-
38-
public InputStream getResourceAsStream(String name) throws IOException {
39-
final InputStream result = classLoader.getResourceAsStream(name);
40-
if (null == result) {
41-
throw new IOException("Unable to find resource " + name);
42-
}
43-
return result;
44-
}
31+
private final ClassLoader classLoader;
32+
33+
public ClasspathResourceLoader(ClassLoader classLoader) {
34+
this.classLoader = classLoader;
35+
}
36+
37+
public InputStream getResourceAsStream(String name) throws IOException {
38+
InputStream result = classLoader.getResourceAsStream(name);
39+
if (null == result) {
40+
throw new IOException("Unable to find resource " + name);
41+
}
42+
return result;
43+
}
4544
}

net.tascalate.javaflow.spi/src/main/java/org/apache/commons/javaflow/spi/CompositeTransformer.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,24 @@
1616
*/
1717
package org.apache.commons.javaflow.spi;
1818

19-
2019
/**
21-
* {@link ResourceTransformer} whose transformation
22-
* is defined in terms of multiple {@link ResourceTransformer}s.
20+
* {@link ResourceTransformer} whose transformation is defined in terms of
21+
* multiple {@link ResourceTransformer}s.
2322
*
2423
* @author Kohsuke Kawaguchi
2524
*/
2625
public class CompositeTransformer implements ResourceTransformer {
27-
final private ResourceTransformer[] transformers;
26+
private final ResourceTransformer[] transformers;
2827

29-
public CompositeTransformer(final ResourceTransformer[] transformers) {
28+
public CompositeTransformer(ResourceTransformer[] transformers) {
3029
this.transformers = transformers;
3130
}
3231

3332
public byte[] transform(byte[] image) {
3433
for (int i = 0; i < transformers.length; i++) {
35-
final byte[] result = transformers[i].transform(image);
34+
byte[] result = transformers[i].transform(image);
3635
if (null != result) {
37-
image = result;
36+
image = result;
3837
}
3938
}
4039
return image;

net.tascalate.javaflow.spi/src/main/java/org/apache/commons/javaflow/spi/ContinuableClassInfo.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
package org.apache.commons.javaflow.spi;
1717

1818
public interface ContinuableClassInfo {
19-
abstract public boolean isContinuableMethod(int access, String name, String desc, String signature);
20-
abstract public boolean isClassProcessed();
21-
abstract public void markClassProcessed();
19+
boolean isContinuableMethod(int access, String name, String desc, String signature);
20+
21+
boolean isClassProcessed();
22+
23+
void markClassProcessed();
2224
}

net.tascalate.javaflow.spi/src/main/java/org/apache/commons/javaflow/spi/ContinuableClassInfoResolver.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@
1818
import java.io.IOException;
1919

2020
public interface ContinuableClassInfoResolver {
21-
abstract public ContinuableClassInfo forget(String className);
22-
abstract public ContinuableClassInfo resolve(String className) throws IOException;
23-
abstract public ContinuableClassInfo resolve(String className, byte[] classBytes);
24-
abstract public boolean isContinuableAnnotation(String annotationClassDescriptor);
25-
abstract public ResourceLoader resourceLoader();
21+
ContinuableClassInfo forget(String className);
22+
23+
ContinuableClassInfo resolve(String className) throws IOException;
24+
25+
ContinuableClassInfo resolve(String className, byte[] classBytes);
26+
27+
boolean isContinuableAnnotation(String annotationClassDescriptor);
28+
29+
ResourceLoader resourceLoader();
2630
}

net.tascalate.javaflow.spi/src/main/java/org/apache/commons/javaflow/spi/ExtendedClasspathResourceLoader.java

Lines changed: 49 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -23,57 +23,54 @@
2323
import java.util.concurrent.Callable;
2424

2525
public class ExtendedClasspathResourceLoader extends ClasspathResourceLoader {
26-
final private static ThreadLocal<Map<String, byte[]>> IN_MEMORY_RESOURCES = new ThreadLocal<Map<String,byte[]>>();
27-
28-
public ExtendedClasspathResourceLoader(final ClassLoader classLoader) {
29-
super(classLoader);
30-
}
31-
32-
public static void runWithInMemoryResources(final Runnable block, final Map<String, byte[]> inMemoryResources) {
33-
runWithInMemoryResources(
34-
new Callable<Void>() {
35-
public Void call() {
36-
block.run();
37-
return null;
38-
}
39-
},
40-
inMemoryResources
41-
);
42-
}
43-
44-
public static <V> V runWithInMemoryResources(final Callable<V> block, final Map<String, byte[]> inMemoryResources) {
45-
final Map<String, byte[]> resources = new HashMap<String, byte[]>(inMemoryResources);
46-
47-
final Map<String, byte[]> previous = IN_MEMORY_RESOURCES.get();
48-
if (null != previous) {
49-
// Merge with previous ones for recursive calls
50-
resources.putAll(previous);
51-
}
52-
IN_MEMORY_RESOURCES.set(resources);
53-
54-
try {
55-
return block.call();
56-
} catch (final RuntimeException ex) {
57-
throw ex;
58-
} catch (final Error ex) {
59-
throw ex;
60-
} catch (Exception ex) {
61-
throw new RuntimeException(ex);
62-
} finally {
63-
IN_MEMORY_RESOURCES.set(previous);
64-
}
65-
66-
}
26+
private static final ThreadLocal<Map<String, byte[]>> IN_MEMORY_RESOURCES = new ThreadLocal<Map<String, byte[]>>();
6727

68-
@Override
69-
public InputStream getResourceAsStream(String name) throws IOException {
70-
final Map<String, byte[]> inMemoryResources = IN_MEMORY_RESOURCES.get();
71-
if (null != inMemoryResources) {
72-
final byte[] bytecode = inMemoryResources.get(name);
73-
if (null != bytecode)
74-
return new ByteArrayInputStream(bytecode);
75-
}
76-
77-
return super.getResourceAsStream(name);
78-
}
28+
public ExtendedClasspathResourceLoader(ClassLoader classLoader) {
29+
super(classLoader);
30+
}
31+
32+
public static void runWithInMemoryResources(final Runnable block, Map<String, byte[]> inMemoryResources) {
33+
runWithInMemoryResources(new Callable<Void>() {
34+
public Void call() {
35+
block.run();
36+
return null;
37+
}
38+
}, inMemoryResources);
39+
}
40+
41+
public static <V> V runWithInMemoryResources(Callable<V> block, Map<String, byte[]> inMemoryResources) {
42+
Map<String, byte[]> resources = new HashMap<String, byte[]>(inMemoryResources);
43+
44+
Map<String, byte[]> previous = IN_MEMORY_RESOURCES.get();
45+
if (null != previous) {
46+
// Merge with previous ones for recursive calls
47+
resources.putAll(previous);
48+
}
49+
IN_MEMORY_RESOURCES.set(resources);
50+
51+
try {
52+
return block.call();
53+
} catch (RuntimeException ex) {
54+
throw ex;
55+
} catch (Error ex) {
56+
throw ex;
57+
} catch (Exception ex) {
58+
throw new RuntimeException(ex);
59+
} finally {
60+
IN_MEMORY_RESOURCES.set(previous);
61+
}
62+
63+
}
64+
65+
@Override
66+
public InputStream getResourceAsStream(String name) throws IOException {
67+
Map<String, byte[]> inMemoryResources = IN_MEMORY_RESOURCES.get();
68+
if (null != inMemoryResources) {
69+
byte[] bytecode = inMemoryResources.get(name);
70+
if (null != bytecode)
71+
return new ByteArrayInputStream(bytecode);
72+
}
73+
74+
return super.getResourceAsStream(name);
75+
}
7976
}

net.tascalate.javaflow.spi/src/main/java/org/apache/commons/javaflow/spi/NopResourceTransformer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
public final class NopResourceTransformer implements ResourceTransformer {
2020

21-
final public static NopResourceTransformer INSTANCE = new NopResourceTransformer();
22-
23-
public byte[] transform(final byte[] original) {
21+
public static final NopResourceTransformer INSTANCE = new NopResourceTransformer();
22+
23+
public byte[] transform(byte[] original) {
2424
return original;
2525
}
2626

net.tascalate.javaflow.spi/src/main/java/org/apache/commons/javaflow/spi/ResourceLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
import java.io.InputStream;
2020

2121
public interface ResourceLoader {
22-
abstract public InputStream getResourceAsStream(String name) throws IOException;
22+
InputStream getResourceAsStream(String name) throws IOException;
2323
}

0 commit comments

Comments
 (0)