Questions tagged [reflections]

For questions about the Java Reflections library (org.reflections.reflections) by ronmamo, which performs Java runtime metadata analysis, in the spirit of Scannotations.

Official GitHub Repository: https://github.com/ronmamo/reflections

155 questions
1
vote
1 answer

"could not create Vfs.Dir" in WAR project with JAR

I have a WAR project which uses 'org.reflections' JAR, and it throws this error: org.reflections.Reflections - could not create Vfs.Dir from url. ignoring the exception and continuing. This only happens with this WAR, I have others that work…
JSP749
  • 127
  • 1
  • 3
  • 12
1
vote
1 answer

Does the Reflections package caches resources

I am using the reflections package to scan some files in my classpath. The code below is run at regular intervals. Basically i am retriving all xml files within a folder 'tmp' in the classpath. This code is being run from a web…
noi.m
  • 3,070
  • 5
  • 34
  • 57
1
vote
2 answers

Does Reflections library ignore the RetentionPolicy

For understanding of the Java annotations I tried some hands on and got few doubts, even though looking at execution I am still confused. Here is what I am doing. Define a…
chaosguru
  • 1,933
  • 4
  • 30
  • 44
1
vote
2 answers

Using Google-Reflection within Groovy causes exception whereas equivalent Java code works

I'm trying to use some code from another answer on SO, and while the code run in Java, from Groovy it causes an exception. The code in question is: Reflections reflections = new Reflections(new ConfigurationBuilder() .setScanners( new…
Sled
  • 18,541
  • 27
  • 119
  • 168
1
vote
1 answer

Reflections and multiple jars

I got two jar files, lets call them domain.jar and scanner.jar. In the scanner jar I have used Reflections library like so: Reflections reflections = new Reflections(new…
vertti
  • 7,539
  • 4
  • 51
  • 81
1
vote
1 answer

Reflections including classes outside the given package (Dropwizard + Swagger)

I am using reflections to obtain all the classes that have the Api annotation with the following code. Reflections reflections = new Reflections(ClasspathHelper.forPackage("my.package"),new TypeAnnotationsScanner()); Set> annotated =…
1
vote
1 answer

Jar library is not recognized inside Intelij IDEA

Hi! I am new to intelij IDEA, and I cannot get google reflection library to work inside intelijIDEA. I've tried adding it as recommender in many sites, by going to the module configuration, then dependency, clicking on the add library icon and…
razielone
  • 123
  • 1
  • 1
  • 6
1
vote
2 answers

Loading the classes from a jar that is dynamically uploaded through a servlet

I am uploading a jar dynamically through servlet and saving it in my WEB-INF/lib directory. I want to get all the classes annotated with my @annotation, have used reflections code below without any luck.. the manifest of the jar is readble but the…
Komal Goyal
  • 233
  • 5
  • 17
1
vote
2 answers

jarInputStream.getManifest() is null

When I upload a jar file to a servlet and try reading its manifest. jarStream.getManifest() returns null.. JarInputStream jarInputStream = new JarInputStream(inputStream); Manifest mf = jarInputStream.getManifest(); While the same jar when I read…
Komal Goyal
  • 233
  • 5
  • 17
1
vote
1 answer

How can I use a library deployed as an uberjar?

I'm trying to use the Reflections 0.9.8 library, which comes as an uber-jar. If I add its JAR ("reflections-0.9.8-uberjar") within my project's build path then Eclipse won't find any of its class types: Reflection, ClasspathHelper and so on. If I…
Alex
  • 301
  • 5
  • 13
0
votes
1 answer

Use reflection to set the return type of a private method

I've been tasked with writing unit tests for poorly authored legacy code. The code that I should write tests for can't get changed in any way whatsoever. It's READ-ONLY.(Company policy, don't touch this!) Please look at the example below: //This…
0
votes
0 answers

Access Java functions (JNI/JNA) from a GraalVM Native Image shared Library

I am having difficulties in accessing java methods from a shared library built with GraalVM. Imagine this code loading a GraalVM Shared library: public class Main { static native int onEnable(long isolateThread, int a); static native long…
0
votes
0 answers

How to use Reflectable package in Dart

I am trying to run this package using Dart not fllutter by fallowing the next steps: Creating the main file as is given here creating a build.yaml: targets: $default: builders: reflectable: generate_for: - main.dart …
Mircea
  • 1,671
  • 7
  • 25
  • 41
0
votes
0 answers

In Java: How do I retrieve filenames of specific resources at runtime from within jar?

This is what my project structure looks like: structure I need to search through a specific subdirectory of the resource's folder for a file that starts with the substring orientation. If I have the filename I can easily load the image in my java fx…
0
votes
1 answer

Deprecated Reflection constructor

I am running sonar cloud through my Java code and it has some deprecated constructors. I managed to update most of them, but not this one: import org.reflections.util.ClasspathHelper; private static final String PACKAGE_ENTITIES =…
gmn_1450
  • 121
  • 4