How can I solve "Discovered unresolved type during parsing" when building a native image? - quarkus

I'm using Quarkus 3.0.0.Alpha3 and I have a dependency to sh.ory.kratos:kratos-client:0.11.0. When I try to build a native image I get:
com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: sh.ory.kratos.model.UiNodeAttributes$1. This error is reported at image build time because class sh.ory.kratos.model.UiNodeAttributes is registered for linking at image build time by command line
I assume that the offending code is this:
static {
schemas.put("UiNodeAnchorAttributes", new GenericType<UiNodeAnchorAttributes>() {
});
In e. g. Quarkus native and org.kohsuke:github-api - unresolved method during parsing - #WithBridgeMethods annotated method it's recommended to "create a Quarkus extension which would substitute the offending pieces of the library."
However, (ignoring that I don't exactly understand what that means) I doubt it would work in this case since the missing class seems to be an anonymous inner class (hence the $1).
Can someone enlighten me? Is there anything I can do?

Related

Firemonkey, C++ Builder, Control-Model-Presentaion, TPresentationProxyFactory registeration Error

There is an unresolved external error in calling of register method of TPresentationProxyFactory, when passing the template based class TWinPresentationProxy__1, as the parameter, xxx is a TWinPresentation descendant class.
TPresentationProxyFactory::Current->Register('xxx', __classid(TWinPresentationProxy__1<xxx>));
The error:
[ilink32 Error] Error: Unresolved external 'Fmx::Presentation::Win::TWinPresentationProxy__1::' referenced from C:\USERS\RR\DESKTOP\MDI\MDI\WIN32\DEBUG\GL_PANEL_WIN.OBJ
It is interesting that the Delphi equivalent line of code is working! Also interesting that TWinPresentationProxy__1 is a PASCALIMPLEMENTATION class?

How to pass unique_ptr object as argument to a class that is a library

I read all the questions and answers related to passing unique_ptr as argument to a class constructor and those answers worked for classes within the exe. But here im trying to pass an unique_ptr object to a class constructor that is pre-compiled as static library.
This class in the library looks something like this,
// Class declaration (in a header file)
class TScreen
{
private:
std::unique_ptr<TProcess> m_process;
public:
__fastcall TScreen(int a, std::unique_ptr<TProcess> i_process);
};
// The constructor definition (in a separate .cpp file)
__fastcall TScreen::TScreen(int a, std::unique_ptr<TProcess> i_process):
m_process(std::move(i_process))
{
}
I will be trying to instantiate the class TScreen in the exe like this,
void TScreen_Main::CallScreen()
{
std::unique_ptr<TProcess> objprocess (new TProcess());
std::unique_ptr<TScreen> objscreen (new TScreen(0, std::move(objprocess)));
}
I compiled the library and imported it to the exe. When i compile the exe, it gives me a link error like this,
[ilink32 Error] Error: Unresolved external '__fastcall TScreen::TScreen(int, std::unique_ptr<TProcess, std::default_delete<TProcess> >)' referenced from TSCREEN_MAIN.OBJ
[ilink32 Error] Error: Unable to perform link
I tried the same with boost::shared_ptr as well and it gives me the same error. But it works fine with raw pointers, but not with smart pointers and i cannot figure out why?
Thanks in advance.
Your problem here is a linking issue. Now, exactly what's going on is difficult for me to say because I never work in a Windows environment, and linking is something that (while very similar) has some distinct differences between a Unix/Linux and a Windows environment.
My guess is that if you explicitly declare your constructor to be inline, and declare that the definition is inline, it will work correctly.
This presumes that the fact that you put the declaration of the class and definition together indicates that the definition is in the header file with the class.
When the compiler sees that it's declared inline it will emit a definition into every compilation unit where it's needed. The linker should then eliminate all the duplicate definitions.
If you really are defining the constructor in some .cpp file separate from the .hpp file that the class is in, and you compiler that .cpp file into .obj file that eventually makes it into a .lib or .dll that you link against when creating the executable, then I don't know what the problem is. If this is the case, you should use the tools that should come with your development environment to see what symbols are actually in the library or the dll because somehow the symbol for the constructor definition isn't there.

IllegalAccessError Java 8 Method reference with package visibility class [duplicate]

Error while executing below code,
Caused by: java.lang.IllegalAccessError: tried to access class
com.google.common.collect.AbstractTable from class
ImmutableTable.copyOf(listItemsToProcess.parallelStream()
.map(item ->
ProcessorInstanceProvider.getInstance()
.buildImmutableTable(item))
.collect(() -> HashBasedTable.create(),
HashBasedTable::putAll,
HashBasedTable<Integer, String,
Boolean>::putAll)
);
Error in coming on - HashBasedTable::putAll Using Oracle's 1.8 jre
This is a compiler bug, related reports are
JDK-8152643: “Javac compiles method reference that allows results in an IllegalAccessError”
JDK-8059632: “Method reference compilation uses incorrect qualifying type”
Note that the first report has the status “Fixed in 8u102”, so downloading JDK8u102 could solve the issue. Of course, when using a compiler other than javac, e.g. ECJ, you have to ensure that that compiler is up to date as well.
In either case, you have to recompile the source code, as it is a compiler issue. But then, the compiled code should even work with older JREs.
To explain the issue, normally, invocations should be encoded into the byte code using the compile-time type of the receiver (or the explicit type in case of static methods), regardless of the declaring type of the actual method implementation. So if you have a public class A inheriting the public method foo from the non-public class B, an invocation of A.foo should be encoded as A.foo rather than B.foo. For ordinary invocations, the compilers work that way, but for method references, javac (and afaik also older versions of ECJ) failed to do that correctly. So when encountering a class trying to access B.foo directly without having access to B, an IllegalAccessError is thrown.
It works when using a lambda expression instead, as then, the invocation is compiled into an ordinary invocation instruction, for which the compiler works correctly, within a synthetic method and a reference to that synthetic method is used when constructing an instance of the functional interface at runtime. Since the synthetic method recides within the same class, it’s always accessible.
AbstractTable was introduced in Guava version 15. Take a look at your classpath configuration; you're probably using an earlier library version at runtime.
Interesting, i replaced method references with Lambda expression and it worked.
ImmutableTable.copyOf(itemList.parallelStream()
.map(item ->
ProcessorInstanceProvider.get()
.buildImmutableTable(item))
.collect(() -> HashBasedTable.create(),
(a, b) -> a.putAll(b),
(a, b) -> a.putAll(b))
);

Class CI_Session_files_driver contains 1 abstract method and must therefore be declared abstract or implement the remaining methods

I have some problems with CodeIgniter, this error is from system file and I don't know how to fix it.
Fatal error: Class CI_Session_files_driver contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read) in E:\Xampp\htdocs\Yachi\system\libraries\Session\drivers\Session_files_driver.php on line 49
A PHP Error was encountered
Severity: Error
Message: Class CI_Session_files_driver contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read)
Filename: drivers/Session_files_driver.php
Line Number: 49
Backtrace:
I read some articles about this, but it doesn't help to find out the answer. Thanks.
The bug seems about windows+php7. Not for CI
Restarting apache server can be a temporary solution. But you should repeat it every time crash happen.
I recommend to use linux enviornment
or Downgrade php version to 5.x until it solve.
Related links I found:
PHP 7, Symfony 3: Fatal error 1 abstract method and must therefore be declared abstract or implement the remaining methods
https://www.drupal.org/node/2711155
https://community.apachefriends.org/viewtopic.php?p=250966&sid=96ef58aaeb7fe142a7dcdfd506a8683f

Can't find a reference to a class that is in the same namespace as the calling class

I have a C# class in Visual Studios2010 that is referencing a globals class in the same namespace. This project is in a solution with several other projects and will build on its own. When I try to build the entire solution it loses reference to the globals class in its own namespace. The weird thing about this is there is another class also using globals in the same namespace and it works just fine.
Things I have tried:
-Changing the framework to every possible option.
-Deleting the class completely cleaning rebuilding restarting my computer etc.
-Making the project the startup project
Any help on this matter would be greatly appreciated I’m chasing my tail at this point.
My guess is that this is a syntax error. I had a similar error earlier today and solved it by, well, fixing said syntax error (specifically removed a rogue closing curly brace). How to test: syntax errors will not propagate above, so just write a method at the very beginning of the class which has trouble referencing the Globals class:
public void testGlobals()
{
Globals testglobals = new Globals(); //or whatever other constructor
}
If it does (i.e. the the class name changes colors and no red squiggly line appears), start moving it down method by method until the class name goes all white (or black, if you're into that retina destroying color scheme) and you get the red squiggly line back. Then fix said syntax error.

Resources