How to instantiate AbstractSourceLookupDirector? - eclipse-plugin

I'm writing a plugin for Eclipse Juno, I want to make use of class AbstractSourceLookupDirector. When I look at the API it says it has a constructor, but when I use following statement in my code, it says "cannot instantiate type AbstractSourceLookupDirector"
AbstractSourceLookupDirector srclookupDir = new AbstractSourceLookupDirector();
Could you please let me know how to make use of AbstractSourceLookupDirector.
Ref: http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.html
Many thanks in advance!

It is an Abstract class, you can't instantiate abstract classes in Java.
What you need to do is configure an extension point org.eclipse.debug.core.sourceLocators
and have your class extend AbstractSourceLookupDirector
An example is given in the juno docs
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fextension-points%2Forg_eclipse_debug_core_sourceLocators.html

Related

fillcover red in initializer dependencies - Quarkus native

I try to build a native container with Quarkus (with -Pnative flag), I use -H:+PrintClassInitialization to generate the class initializer reports. I see a initilizer_dependencies_yyyymmdd_hhmmss.dot file is generated; in this file, I see some classes marked with [fillcover=red], could you tell me what this means? and what action is needed?
Thanks
it seems to me those classes are the ones that will be called but not in reflection configuration. I add them in reflection or initialize to solve it.

Java method not available in Kotlin?

I am using the ejml-library (written in Java) in a Kotlin project. I imported the library (everything seems to work fine) in IntelliJ. However, some methods which should be available (e.g. the inherited getDDRM() method of the class SimpleMatrix) are not recognized and I can't use them. Whats very weird is that the very same procedure used with Scala (also using IntelliJ) works. That is, in Scala I can access the method - with Kotlin I can't.
It would be great if someone could shed some light on this.
update:
the getDDRM() method is part of the abstract class "Class SimpleBase<T extends SimpleBase>" and has the following signature: "public DMatrixRMaj getDDRM()". In my code I call this method on an instance of class SimpleMatrix which is a concrete class inheriting the SimpleBaseClass –
I should also note that I rebuild it with gradle and the issue still persists.
IMPORTANT: I should add that I can access other methods defined in the very same class. For instance I can access the method getMatrix() which is just another method of the very same (abstract) class. In fact, IntelliJ's method completion shows me a whole list of methods - but the getDDRM() is missing. I really don't get the cause of this problem.
Update 2:
If it is of any help: When I do not use gradle but instead open a Kotlinproject in IntelliJ and add the libary jars manually then everything works fine. Can anyone explain this?
Thanks in advance!

Kotlin - Why isn't there a "Progression" interface like in the case of "ClosedRange"?

Kotlin has defined:
class CharRange : CharProgression, ClosedRange<Char>
but looking at CharProgression:
open class CharProgression : Iterable<Char>
there is no Progression interface. It directly implements Iterable.
Why doesn't Kotlin define a Progression interface as it has done with ClosedRange?
Maybe someone from JetBrains will correct me, but I would assume that the reason lies here:
// Auto-generated file. DO NOT EDIT!
import kotlin.internal.getProgressionLastElement
All this class hierarchy, including internal CharProgressionIterator is being auto-generated. Hence, being both internal and generated, it doesn't make much sense to have an interface nothing but the generated code would use.

Is it possible to get the Extension class loader object?

I'm learning about ClassLoading concepts in java.
I know that can get the System classLoader with ClassLoader.getSystemClassLoader() method using java.lang.ClassLoader class. Is it possible to get Extension class loader also?
I'm aware that JVM loads the BootStrapClassLoader and we cannot instantiate it. But what about Extension class loader?
Thanks in Advance.
You can try this one sun.net.spi.nameservice.dns.DNSNameService.getClassLoader(). DNSNameService is one the class that exist as the Extension class loader.
Another option is to write something like this:
ClassLoader cl =new Object(){}.getClass().getEnclosingClass().getClassLoader();
ClassLoader prev = null;
while(cl!=null){
prev=cl;
cl=cl.getParent();
}
System.out.println(prev);
prev will contain reference to extension class loader.
Note: You can write besides
new Object(){}.getClass().getEnclosingClass().getClassLoader() idiom Thread.currentThread().getContextClassLoader() or even simpler YourClassName.class.getClassLoader() While these idioms are not identical any of them will do the job.
See http://www.javacodegeeks.com/2011/03/understanding-extending-java.html for some more details.

How do you extend a C# interface in C++/CLR?

I'm really frustrated with this one. I'm trying to extend a C# created interface in C++/CLR. The interface has one method and I've declared it in my class, but the compiler keeps telling me that I must still provide an implementation for the interface method. What more can I do? What am I missing!?
Does anyone have any examples of how to extend a C# interface in CLR?
I figured it out! I needed to make the implementation of elements virtual. I hope this helps other people with this same issue.