28 questions
-8
votes
1
answer
112
views
Are there any plans to expose internal arrays in java.lang.String? [closed]
When trying to performance-tune our XML parsing/validation/binding pipeline, I frequently hit the wall because java.lang.String neither exposes its internal backing array byte[] value / byte coder nor ...
0
votes
1
answer
149
views
lambdametafactory creation is quite slow compared to just using lambda
@Benchmark
public void testLambdaGeneration(Blackhole bh) {
Function<Object, Object> function = a -> {
if(a instanceof Alpha alpha) {
return alpha.primitiveInt();
...
3
votes
2
answers
635
views
MethodHandle cannot be cracked when using LambdaMetafactory?
I want to convert a Record's constructor to a Function<Object[], T> using lambdametafactory (T is a generic type), here are my codes:
public record R(
String a,
String b
) {
}
...
3
votes
1
answer
305
views
How is it possible to dynamically convert a method object into a functional interface in Java?
I have a few classes that each implement an interface. From these classes I search out a method using an annotation. This method returns a boolean and always has an object as parameter, which always ...
0
votes
1
answer
137
views
Is the built-in LambdaMetafactory parameter type checking correct?
For example, when I execute the following:
public static int addOne(Number base) {
return base.intValue() + 1;
}
public static interface AddOneLambda {
public int addOne(Integer base);
}
public ...
2
votes
1
answer
758
views
LambdaMetaFactory and Private Methods
I would like to use LambdaMetaFactory to efficiently access a private method.
public class Foo {
private void bar() { // here's what I want to invoke
System.out.println("bar!");
}
}
...
0
votes
1
answer
276
views
Transform Method from file into LambdaExpresion [duplicate]
I'm trying to transform a Method (read from a file) into a lambda expression, so I can measure the time needed to execute that Method ignoring the slow Method.invoke(...) function.
I've been trying to ...
0
votes
0
answers
265
views
Using LambdaMetaFactory to expose getters causes class cast exception
I'm using LambdaMetaFactory to expose getters. I have a POJO with many fields and I don't know which fields are going to be populated. I'm trying to avoid both an extended if statement and also ...
3
votes
1
answer
781
views
Create BiConsumer from LambdaMetafactory
I'm trying to dynamically create a method reference of type BiConsumer through LambdaMetafactory.
I was trying to apply two approaches found on https://www.cuba-platform.com/blog/think-twice-before-...
3
votes
1
answer
522
views
How to create proxy object at runtime using LambdaMetaFactory?
How can I create proxy objects for SAM/functional interfaces using LambdaMetaFactory
ie. equivalent of
public static Object java.lang.reflect.Proxy.newProxyInstance(ClassLoader, Class<?>[], ...
1
vote
1
answer
783
views
NoClassDefFoundError for my own class when creating CallSite with LambdaMetafactory
I’m trying to create a small utility to replace my use of reflection across my entire project (mostly for performance benefits of using LambdaMetafactory) but I’m stumbling at the creation of a ...
2
votes
2
answers
807
views
How to instantiate an object using LambdaMetaFactory?
I have an interface Action:
package action;
public interface Action {
public String act();
}
Class SimpleAction:
package action;
public class SimpleAction implements Action {
String action;...
7
votes
2
answers
2k
views
LambdaMetaFactory with concrete implementation of generic type
I am trying to use Java's LambdaMetaFactory to dynamically implement a generic lambda, Handler<RoutingContext>:
public class RoutingContext {
// ...
}
@FunctionalInterface
public interface ...
0
votes
1
answer
929
views
Java LambdaMetaFactory Method call with multiple vargs to avoid Reflection
I am currently using Java reflection
I don't have any problem doing it with reflection . I learned about LambdaMetaFactory has better performance than reflection .. There is examples about getter ...