I have a class A extending class B. Class A is autoloaded during reflection, which in turn autoloads class B.
When there is a parse in class B, I only get an exception saying class A does not exist, the parse error in class B is hidden.
A usable solution would be to somehow catch the parse error when running require_once, but the parse error should ideally be handled the normal way rather than be hidden.
Related
Say I have a class library project (Library) which contains a class of:
Public Class SomeClass(Of TTypeA, TTypeB)
Then, in another project UIProject in a different solution, I define a class that is derived from (inherits) SomeClass:
Imports Library
Public Class SomeDerivedClass
Inherits SomeClass(Of String, Boolean)
I have included Library.pdb and Library.xml alongside Library.dll (in the same folder) when I added the class libary reference to the UIProject.
Now, In UIProject I create a ClassDiagram (ClassDiagram1.cd), and add in the SomeClass class. So far so good.
The next step is to right-click on SomeClass in the diagram, and select "Show Base Class" from the dropdown. At this point, I am given the error:
Error HRESULT E_FAIL has been returned from a call to a COM
component.
If I do the same but for a non-generic version of SomeClass, then SomeClass is included in the class diagram, no problem.
No errors show up in ActivityLog.xml; nor in the Windows Event Viewer.
Is this a bug in Visual Studio (in which case I'll report it); or am I doing something wrong (and if so are there any other error logs or traces I can do to narrow down the issue further)?
The answer seems to be that COM does not work with generic types; and that it works in VS2017.
I am new to Groovy programing and I am currently trying to test a web app with Geb and Spock on IntelliJ IDE. I wanted to try a simple script first without using Spock, that is why I use a simple main class for creating Browser and so on and run some basic tests (understand: verifying if I am at the correct page).
Everything was working well but I had a lot of page class that were melt in the same folder as my main class, modules and so on. So I decided to clean up by using packages. Here is my project folders:
src
---main
------groovy
------------app
---------------module
---------------pages
---------------templates
module folder contains the modules used in my pages
pages folder contains the actual page the browser will browse
templates folder contains some super pages class for not repeating content through pages instances.
My class Main with main method is in app folder.
So I re-run the code that was previously working well (when every source files were in the same folder) and I get an error Exception in thread "main" groovy.lang.MissingPropertyException: No such property: homePage for class: app.pages.loginPage
The line that seems to be the problem is this one (in loginPage.groovy) :
loginButton(to: homePage){$("input", id: "loginButton_submit")}
Which is in the static content of loginPage class.
I don't understand why I get this error as loginPage and homePage are in the same package. I guess I don't understand some groovy stuff here or compiling mechanics.
Here is the error messages I got :
The package is the correct one both in homePage and loginPage (they are in the same one) so the class seems to be resolved. But when running, `homePage` is considered as a static property of `loginPage`I suppose and as it is not declared in `loginPage` properties it cannot work. Here is my log :
Exception in thread "main" groovy.lang.MissingPropertyException: No such property: homePage for class: app.pages.loginPage
at groovy.lang.MetaClassImpl.invokeStaticMissingProperty(MetaClassImpl.java:1004)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1859)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1835)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3735)
at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:175)
at groovy.lang.Closure.getPropertyTryThese(Closure.java:312)
at groovy.lang.Closure.getPropertyOwnerFirst(Closure.java:306)
at groovy.lang.Closure.getProperty(Closure.java:295)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:50)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
at app.pages.loginPage$__clinit__closure4.doCall(loginPage.groovy:28)...
Do you have any ideas ?
Check to see if the package your homePage belongs to was updated when you moved it from "main" to "pages":
package app.pages
class homePage extends Page {
}
If the package is incorrect or undeclared on the homePage class your loginPage will not be able to resolve it
Finally solved it thanks to this comment:
Note that by convention class names in Java and Groovy usually start with a capital letter.
All my classes where considered as variable. I still don't get why the behavior is different in default package so if anyone has a clue...
Thanks all for your help.
"Base class <baseclassname1> specified for class
'' cannot be different from the base class
'' of one of its other partial types"
The problem is that I only declared the class in one place, the actual class file, and only declared it once, non partially.
All my other classes that inherit from "DialogBase" work fine, but one file with the most code just stopped working.
What else could be the problem? Could it be declared partial somewhere else?
Class CostDialog inherits DialogBase(This works fine)
Class Blend inherits DialogBase(This errors)
Blend is only written as Public Class Blend in the Blend.vb file ONCE
This error makes no sense
You may have multiple code behind files with the same class name. I was converting a web site to a web application and found that there were two instances of Home. So Project/abc/home.aspx /aspx.vb and Project/def/home.aspx/ /aspx.vb will cause a conflict if both home.aspx.vb files have the same class name.
My fix was to leave all the file names untouched but modify the class name to abc_home and def_home in their respective code behind file and then change the Inherits property at the top of their .aspx pages.
Highly doubt this is still an issue for you, but maybe for someone else.
I have an object A in Smalltalk and I want to override a method specifically the method compile in the behavior.
my aim is to customize compile method by adding asserts before compiling a code.
I know that compile is found in the A class (up until behavior) but how can I use it ?
I have tried a lot of ways non are working, the last of what I did is :
I defined a method :
compile:code
self class compile:code. "this is not working it tells me message not understood"
how can I do this ?
[Pharo] Try redefining the method #compile:classified:withStamp:notifying: on the class side of your class. In this new implementation combine the assertion code with the first parameter (which is the source code you are about to compile) and then delegate to super with the modified code.
Is there a way to set a breakpoint for when a particular Java class is loaded in IntelliJ IDEA?
In 2016 version it works by setting the breakpoint to the class definition line (public class YourClass ...). You don't have to use explicit constructor, it stops when ... new YourClass(); is called.
Not that I know of. But if you are trying to determine from where a class is first being loaded, you could put a break point in the constructor (or static fields/block) of the class, and look at the stack trace. That should tell you where the first call to the class is being made.