Field/Method Annotation searching by Meta-annontation

1 view
Skip to first unread message

Ronald R. DiFrango

unread,
Mar 27, 2017, 12:31:14 PM3/27/17
to FastClasspathScanner-Users
First off thanks for a great tool, I discovered as I was searching for an alternative to org.reflections.

Now, the one case I found a gap in how we use it, is that the method level search doesn't support the ability to search for a meta-annotations like the class level one does.  Any there any plans to support this?

Luke Hutchison

unread,
Mar 27, 2017, 3:08:08 PM3/27/17
to Ronald R. DiFrango, FastClasspathScanner-Users
Hi Ronald, 

Your welcome, I'm glad it (mostly so far!) works for you.

If I understand your question, then yes, there are variants of the annotation scanning methods with "Direct" in their name, and they only look at direct annotations, not direct annotations and meta-annotations (let me know if that's what you were looking for). However, this is currently only supported for scanning Mechanisms 2 and 3. I didn't think about the fact that this might be needed for MatchProcessors too. I could add that. 

However, I'm curious, why do you want to exclude meta-annotations?

Best, 
Luke


On Mar 27, 2017 9:31 AM, "Ronald R. DiFrango" <ron.di...@gmail.com> wrote:
First off thanks for a great tool, I discovered as I was searching for an alternative to org.reflections.

Now, the one case I found a gap in how we use it, is that the method level search doesn't support the ability to search for a meta-annotations like the class level one does.  Any there any plans to support this?

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsub...@googlegroups.com.
To post to this group, send email to fastclasspathscanner-users@googlegroups.com.
Visit this group at https://groups.google.com/group/fastclasspathscanner-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/fastclasspathscanner-users/bfc37cf2-7f5c-436b-968b-873a18d078fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luke Hutchison

unread,
Mar 27, 2017, 3:09:33 PM3/27/17
to Ronald R. DiFrango, FastClasspathScanner-Users
Egregious autocorrect typo: You're welcome, not Your welcome, I didn't look up as I told this in my phone :) 

On Mar 27, 2017 12:08 PM, "Luke Hutchison" <luke....@gmail.com> wrote:
Hi Ronald, 

Your welcome, I'm glad it (mostly so far!) works for you.

If I understand your question, then yes, there are variants of the annotation scanning methods with "Direct" in their name, and they only look at direct annotations, not direct annotations and meta-annotations (let me know if that's what you were looking for). However, this is currently only supported for scanning Mechanisms 2 and 3. I didn't think about the fact that this might be needed for MatchProcessors too. I could add that. 

However, I'm curious, why do you want to exclude meta-annotations?

Best, 
Luke

On Mar 27, 2017 9:31 AM, "Ronald R. DiFrango" <ron.di...@gmail.com> wrote:
First off thanks for a great tool, I discovered as I was searching for an alternative to org.reflections.

Now, the one case I found a gap in how we use it, is that the method level search doesn't support the ability to search for a meta-annotations like the class level one does.  Any there any plans to support this?

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsubsc...@googlegroups.com.

Ronald R. DiFrango

unread,
Mar 27, 2017, 3:47:41 PM3/27/17
to FastClasspathScanner-Users
So I'm doing it this way:

//
// Scanning
//
ScanResult result = new FastClasspathScanner("com.test")
.enableMethodAnnotationIndexing()
.ignoreFieldVisibility()
.ignoreMethodVisibility()
.scan();

// This works for classes
//
// Namely: MyFeatureBean gets found.
//
List<Class<?>> featureClasses = result.classNamesToClassRefs(
                result.getNamesOfClassesWithAnnotationsAnyOf(MyFeature.class), true);

// This doesn't work on the method
//
// Namely: TestFeatureUsingMetaAnnotations. featureBean
//
List<Class<?>> featureBeans = result.classNamesToClassRefs( result.getNamesOfClassesWithMethodAnnotation(MyFeature.class), true); Where: @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Configuration @MyFeature("FeatureConfigurationUsingMetaAnnotation") private @interface MyFeatureConfiguration { } @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Bean @MyFeature("FeatureConfigurationUsingMetaAnnotation.featureBean") private @interface MyFeatureBean { } @MyFeatureConfiguration private static class TestFeatureUsingMetaAnnotations { @MyFeatureBean public void featureBean() { } }

On Monday, March 27, 2017 at 3:09:33 PM UTC-4, Luke Hutchison wrote:
Egregious autocorrect typo: You're welcome, not Your welcome, I didn't look up as I told this in my phone :) 
On Mar 27, 2017 12:08 PM, "Luke Hutchison" <luke....@gmail.com> wrote:
Hi Ronald, 

Your welcome, I'm glad it (mostly so far!) works for you.

If I understand your question, then yes, there are variants of the annotation scanning methods with "Direct" in their name, and they only look at direct annotations, not direct annotations and meta-annotations (let me know if that's what you were looking for). However, this is currently only supported for scanning Mechanisms 2 and 3. I didn't think about the fact that this might be needed for MatchProcessors too. I could add that. 

However, I'm curious, why do you want to exclude meta-annotations?

Best, 
Luke

On Mar 27, 2017 9:31 AM, "Ronald R. DiFrango" <ron.di...@gmail.com> wrote:
First off thanks for a great tool, I discovered as I was searching for an alternative to org.reflections.

Now, the one case I found a gap in how we use it, is that the method level search doesn't support the ability to search for a meta-annotations like the class level one does.  Any there any plans to support this?

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsub...@googlegroups.com.
To post to this group, send email to fastclasspath...@googlegroups.com.

Luke Hutchison

unread,
Mar 27, 2017, 5:08:23 PM3/27/17
to Ronald R. DiFrango, FastClasspathScanner-Users
Sorry, I misunderstood your original question. Good catch. I added scanning for meta-annotations of fields and methods to the master version, please test and let me know if it works for you. Thanks!



To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsubsc...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsub...@googlegroups.com.
To post to this group, send email to fastclasspathscanner-users@googlegroups.com.

Ronald R. DiFrango

unread,
Mar 27, 2017, 10:41:39 PM3/27/17
to FastClasspathScanner-Users
I cloned the repo and downloaded it locally to build, but I'm getting a random complier failure with no real output.  I'm wonder if its the following directive and something I'm missing:


${testCompileJdkPath}/bin/javac

To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsub...@googlegroups.com.
To post to this group, send email to fastclasspath...@googlegroups.com.
Visit this group at https://groups.google.com/group/fastclasspathscanner-users.

Luke Hutchison

unread,
Mar 27, 2017, 10:43:26 PM3/27/17
to Ronald R. DiFrango, FastClasspathScanner-Users
What's the complete compilation error you're getting?


To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsubsc...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsubsc...@googlegroups.com.

To post to this group, send email to fastclasspath...@googlegroups.com.
Visit this group at https://groups.google.com/group/fastclasspathscanner-users.

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsub...@googlegroups.com.
To post to this group, send email to fastclasspathscanner-users@googlegroups.com.

Ronald R. DiFrango

unread,
Mar 27, 2017, 10:49:45 PM3/27/17
to FastClasspathScanner-Users

so I skipped tests and I just noticed this:


[DEBUG] Generating signature for /Users/vcq554/Documents/workspaces/lukehutch/fast-classpath-scanner/target/fast-classpath-scanner-2.0.19-SNAPSHOT.jar

/bin/sh: gpg: command not found


and then the failure:


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (sign-artifacts) on project fast-classpath-scanner: Exit code: 127 -> [Help 1]

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (sign-artifacts) on project fast-classpath-scanner: Exit code: 127

To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsub...@googlegroups.com.
To post to this group, send email to fastclasspath...@googlegroups.com.
Visit this group at https://groups.google.com/group/fastclasspathscanner-users.

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsub...@googlegroups.com.
To post to this group, send email to fastclasspath...@googlegroups.com.
Visit this group at https://groups.google.com/group/fastclasspathscanner-users.

Ronald R. DiFrango

unread,
Mar 27, 2017, 10:54:29 PM3/27/17
to FastClasspathScanner-Users
so I installed gpg via brew and now its:

gpg: directory `/Users/rdifrango/.gnupg' created

gpg: new configuration file `/Users/rdifrango/.gnupg/gpg.conf' created

gpg: WARNING: options in `/Users/rdifrango/.gnupg/gpg.conf' are not yet active during this run

gpg: keyring `/Users/rdifrango/.gnupg/secring.gpg' created

gpg: keyring `/Users/rdifrango/.gnupg/pubring.gpg' created

gpg: no default secret key: No secret key

gpg: signing failed: No secret key

Luke Hutchison

unread,
Mar 27, 2017, 11:36:44 PM3/27/17
to Ronald R. DiFrango, FastClasspathScanner-Users
Which maven rule are you triggering? The one you want is "package". Also note that Maven doesn't work right unless JAVA_HOME is set to point to the JRE root. You can also do "-Dmaven.test.skip=true" to skip the tests. Putting it all together:

JAVA_HOME=/usr/java/default mvn -Dmaven.test.skip=true package

I just tested this in a clean account, and it works for me. Please let me know if that works for you too.

I'll update the docs with the above info.


To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsubsc...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsubsc...@googlegroups.com.

To post to this group, send email to fastclasspath...@googlegroups.com.
Visit this group at https://groups.google.com/group/fastclasspathscanner-users.

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsubsc...@googlegroups.com.

To post to this group, send email to fastclasspath...@googlegroups.com.
Visit this group at https://groups.google.com/group/fastclasspathscanner-users.

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsub...@googlegroups.com.
To post to this group, send email to fastclasspathscanner-users@googlegroups.com.

Luke Hutchison

unread,
Mar 27, 2017, 11:45:04 PM3/27/17
to Ronald R. DiFrango, FastClasspathScanner-Users
In other words, the complete compilation steps are:

git clone https://github.com/lukehutch/fast-classpath-scanner.git
cd fast-classpath-scanner
export JAVA_HOME=/usr/java/default      # Or similar
mvn -Dmaven.test.skip=true package


Then the compiled package will be in the "target" directory.



Ronald R. DiFrango

unread,
Mar 28, 2017, 9:00:44 AM3/28/17
to FastClasspathScanner-Users
That worked

mvn -Dmaven.test.skip=true package

I was trying:

mvn -Dmaven.test.skip=true install

now, the trick is that I'm going to have to manually install it into my MV2 repo so I can test.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsub...@googlegroups.com.

To post to this group, send email to fastclasspath...@googlegroups.com.
Visit this group at https://groups.google.com/group/fastclasspathscanner-users.

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsub...@googlegroups.com.

To post to this group, send email to fastclasspath...@googlegroups.com.
Visit this group at https://groups.google.com/group/fastclasspathscanner-users.

--
You received this message because you are subscribed to the Google Groups "FastClasspathScanner-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fastclasspathscanner-users+unsub...@googlegroups.com.

To post to this group, send email to fastclasspath...@googlegroups.com.
Visit this group at https://groups.google.com/group/fastclasspathscanner-users.

Luke Hutchison

unread,
Mar 28, 2017, 9:15:24 AM3/28/17
to Ronald R. DiFrango, FastClasspathScanner-Users
Yeah, Maven makes even simple things like adding a single local jar to your project immensely difficult. 
Reply all
Reply to author
Forward
0 new messages