Hi Stuart!!! :)
I received your reply just after a second I reposted :)
Thanks a lot for your suggestions, I'll try do follow them as well!!!
Simo

http://people.apache.org/~simonetripodi/
http://www.99soft.org/



On Wed, Nov 24, 2010 at 2:55 PM, Stuart McCulloch <[email protected]> wrote:
> On 24 November 2010 13:33, Simone Tripodi <[email protected]> wrote:
>>
>> Hi all guys,
>> I need to bind a Provider generated by ASM with injection points
>> generated on the fly, everything gone fine until injection points
>> resolution by Guice, and got the errors below; I tried to hack the
>> com.google.inject.internal.MapMaker class loader, adding the new class
>> definition, but without success.
>
> it's not an issue with MapMaker as such, but the Guice LineNumbers utility
> that attempts to supply meaningful source locations for debugging bindings
>   public LineNumbers(Class type) throws IOException {
>     this.type = type;
>     if (!type.isArray()) {
>       InputStream in = type.getResourceAsStream("/" +
> type.getName().replace('.', '/') + ".class");
>       Preconditions.checkArgument(in != null, "Cannot find bytecode for %s",
> type);
>       new ClassReader(in).accept(new LineNumberReader(),
> ClassReader.SKIP_FRAMES);
>     }
>   }
> ^ this expects to find a class resource - but of course if you're generating
> the provider class completely from scratch with ASM then it won't exist :/
> to workaround this issue you could supply your own source when binding
> your generated provider - this should then bypass the LineNumber code:
>   Binder generatedCodeBinder = binder.withSource( "[generated]" );
>   generatedCodeBinder.bind( ...etc...
> HTH
>>
>> Does someone know how guice resolved that issue when enhancing the
>> classes with AOP?
>
> it's not an issue with Guice's internal AOP because that's applied on top
> of classes already registered with the injector - so the LineNumbers code
> never has to handle internal proxies
>
>>
>> Many thanks in advance, have a nice day!
>> Simo
>>
>> com.google.inject.internal.ComputationException:
>> java.lang.IllegalArgumentException: Cannot find bytecode for class
>> org.mybatis.guice.datasource.helper.FormattedProvider
>>        at
>> com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:553)
>>        at
>> com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:419)
>>        at
>> com.google.inject.internal.CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
>>        at
>> com.google.inject.internal.StackTraceElements.forMember(StackTraceElements.java:53)
>>        at
>> com.google.inject.internal.Errors.formatInjectionPoint(Errors.java:635)
>>        at com.google.inject.internal.Errors.formatSource(Errors.java:597)
>>        at com.google.inject.internal.Errors.format(Errors.java:474)
>>        at
>> com.google.inject.CreationException.getMessage(CreationException.java:48)
>>        at java.lang.Throwable.getLocalizedMessage(Throwable.java:267)
>>        at java.lang.Throwable.toString(Throwable.java:344)
>>        at java.lang.String.valueOf(String.java:2615)
>>        at java.io.PrintWriter.print(PrintWriter.java:546)
>>        at java.io.PrintWriter.println(PrintWriter.java:683)
>>        at java.lang.Throwable.printStackTrace(Throwable.java:510)
>>        at org.junit.runner.notification.Failure.getTrace(Failure.java:65)
>>        at
>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestListener.testFailure(JUnit4TestListener.java:68)
>>        at
>> org.junit.runner.notification.RunNotifier$4.notifyListener(RunNotifier.java:100)
>>        at
>> org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:41)
>>        at
>> org.junit.runner.notification.RunNotifier.fireTestFailure(RunNotifier.java:97)
>>        at
>> org.junit.internal.runners.ErrorReportingRunner.runCause(ErrorReportingRunner.java:57)
>>        at
>> org.junit.internal.runners.ErrorReportingRunner.run(ErrorReportingRunner.java:34)
>>        at
>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
>>        at
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>        at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>>        at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>>        at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>>        at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>> Caused by: java.lang.IllegalArgumentException: Cannot find bytecode
>> for class org.mybatis.guice.datasource.helper.FormattedProvider
>>        at
>> com.google.inject.internal.Preconditions.checkArgument(Preconditions.java:113)
>>        at
>> com.google.inject.internal.LineNumbers.<init>(LineNumbers.java:57)
>>        at
>> com.google.inject.internal.StackTraceElements$1.apply(StackTraceElements.java:36)
>>        at
>> com.google.inject.internal.StackTraceElements$1.apply(StackTraceElements.java:33)
>>        at
>> com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:549)
>>        ... 26 more
>>
>>
>>
>> http://people.apache.org/~simonetripodi/
>> http://www.99soft.org/
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "google-guice" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/google-guice?hl=en.
>>
>
>
>
> --
> Cheers, Stuart
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to