• Post Reply Bookmark Topic Watch Topic
  • New Topic

False constructor errors  RSS feed

 
Joseph Marckus
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First things first: All files used are made by others. I am attempting to, as an EXTREME novice to JAVA, update them to work with the newest version of the plugin. Yes, these files are created and designed for use with Minecraft and it's varying plugins. All files are licensed as public and editable by others so long as the original author is provided in the files.

Now to the point: As stated above, I am attempting to upgrade certain .Jars to work with the newest version of a particular plugin. I have all the necessary files in their respective states. I was having some issues with one of my updated files, my first one sadly enough, where I was receiving a "No suitable constructor found for ExpirableEffect" error. I found this odd considering my coding should have been perfect. After fighting with this for 4 hours I decided to try something on a hunch. I took the NEW file that I was using as a template to update the OLD file, decompiled it with JD-GUI. After inputting it into NewBeans I try to rebuild it, and Viola! It has the SAME errors! But this file works without a problem in the plugin when running. I tested it several times in action to make sure it worked.
I am convinced that one of two things have/are occuring. Either netbeans is being a **** and throwing a fit over nothing, or the original author who created the NEW file bypassed the "On error, abort build" feature. I am not asking you all do to the work for me. I have not had the time to learn all that JAVA has to offer, but will eventually do it as my 2 jobs permit. What I WOULD like from you as a community is examples, advice or more to help me solve this issue. I have a feeling that this will occur often as I edit the 73 files that need to be updated. I learn better by watching how it is done, then doing it myself. Files are linked below followed by the error provided in my EDITED file.

Pre-made WORKING file: (This is the one that works just fine, but that NetBeans says has a large number of errors and refuses to re-compile).
http://pastebin.com/159qx6FK

Original OLD file: (this is the one I am trying to update)
http://pastebin.com/8HesEZJP

Edited OLD file: (What I am 90% sure should work without an issue, but coming up with the 1 error)
http://pastebin.com/48BRwKgJ

Expirableeffect: (The file indicated in the Constructor issue for the 'Edited OLD file')
http://pastebin.com/rmXHMF6e



As a final bit: It would just be simpler if I could bypass the "abort build on error" and test it myself. Is there a way to do this? Does not have to necessarily be in Netbeans.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch. I can explain you what the error means:

You have a class SkillLightningBlade, which is a subclass of ExpirableEffect (so, class SkillLightningBlade extends ExpirableEffect).

Your class SkillLightningBlade has a constructor that needs to call a constructor from its superclass. It does this using the following line:

It tries to call the constructor in class ExpirableEffect that takes two arguments: a String and a long.

The compiler is telling you that class ExpirableEffect does not have a constructor that takes a String and a long. The compiler even tells you what constructors it found in class ExpirableEffect and why they are not applicable:

constructor ExpirableEffect.ExpirableEffect(Skill,Heroes,String,long) is not applicable
(actual and formal argument lists differ in length)
constructor ExpirableEffect.ExpirableEffect(Skill,String,long) is not applicable
(actual and formal argument lists differ in length)

It tells you that ExpirableEffect has two constructors; the first one takes four arguments (a Skill, a Heroes, a String and a long) and the second one takes three arguments (a Skill, a String and a long).

If the original code already had the wrong constructor in it, then it might have been compiled for an older version of ExpirableEffect which did have a constructor with two arguments; maybe that constructor has been removed in a newer version.

To fix it, you should change the super(...); call so that it calls one of the two constructors that the compiler says are available in class ExpirableEffect (with four or three arguments). You'd have to find out what to pass exactly for the extra arguments.
 
Joseph Marckus
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply.
I understand the error and where it comes from after doing a bit of digging around. What confounds me is why the CURRENT pre-made that I am using as a template WORKS, even though it has the same line (Changed to a different name, but all variables are the same) and receives the same errors and more. This CURRENT template file was built by the original plugin author using the current ExpirableEffect file. NetBeans believes that it should not work, but as testing has proven, it DOES work.

Template file reads as:


The difference in this is the Type.applicationsleft, the added integer and the skillname of Poisonblade instead of Lightningblade. Netbeans provides the same Constructor error as my Lightningblade version, BUT it has obviously been compiled in this current state and works with the provided ExpirableEffect file.

Edit: I reviewed 4 other files. ALL use the same line with the exception of the skillname being different. All work when used within the plugin with no errors. At this point I would like to find a way to force it to compile and ignore errors.

Edit2: I tried something strange and outrageous. I merely changed the line to "super(skill, "Lightningbladeeffect", duration);" and it worked. (Without the start or end " of course. All effects and lines come out green and good to go and work when introduced into the plugin. It is still odd that the Template files work just fine without the addition.

I feel as though I am missing something very important in all this, but it continues to elude me.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you look at the class ExpirableEffect? What constructors does it have?

Are you compiling this against a different version of the ExpirableEffect class than what you are running it with?
 
Joseph Marckus
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The constructors are as indicated and the same as you posted. I am compiling with the exact same ExpirableEffect. The Pastebins that I provided have this information in them.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!