Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: [1] 2

Author Topic: What is a InstantiationException? Why is it happening to my spawn point?  (Read 7650 times)

oranoron

  • Lieutenant
  • **
  • Posts: 85
    • View Profile

Spoiler
22520 [Thread-6] ERROR com.fs.starfarer.combat.String  - java.lang.RuntimeException: Problem loading class [data.scripts.world.instrumentalitySpawnPoint]
java.lang.RuntimeException: Problem loading class [data.scripts.world.instrumentalitySpawnPoint]
   at com.fs.starfarer.loading.scripts.ScriptStore.o00000(Unknown Source)
   at com.fs.starfarer.loading.new.o00000(Unknown Source)
   at com.fs.starfarer.campaign.save.CampaignGameManager.o00000(Unknown Source)
   at com.fs.starfarer.title.OoOO.dialogDismissed(Unknown Source)
   at com.fs.starfarer.ui.float.dismiss(Unknown Source)
   at com.fs.starfarer.ui.impl.I.dismiss(Unknown Source)
   at com.fs.starfarer.campaign.save.H.actionPerformed(Unknown Source)
   at com.fs.starfarer.ui.privatesuper.super(Unknown Source)
   at com.fs.starfarer.ui.F.processInput(Unknown Source)
   at com.fs.starfarer.ui.OoOo.o00000(Unknown Source)
   at com.fs.starfarer.OoOO.øÒÒ000(Unknown Source)
   at com.fs.super.oOOO.Ò00000(Unknown Source)
   at com.fs.starfarer.combat.String.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.InstantiationException: data.scripts.world.instrumentalitySpawnPoint
   at java.lang.Class.newInstance0(Class.java:340)
   at java.lang.Class.newInstance(Class.java:308)
   ... 15 more
[close]
Logged

oranoron

  • Lieutenant
  • **
  • Posts: 85
    • View Profile
Re: What is a InstantiationException? Why is it happening to my spawn point?
« Reply #1 on: December 05, 2013, 11:50:14 AM »

Well I know know what an Instantiation Exception is but it has not help me figure out why the game is rejecting my spawn point. I have it listed in the generators.csv, I have gone through and made sure my spelling has been consistent and I've followed the "How to get your faction into the game" tutorial as closely as I could for it being out of date. I still can't figure out what it is that is being rejected.
« Last Edit: December 05, 2013, 12:05:12 PM by oranoron »
Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: What is a InstantiationException? Why is it happening to my spawn point?
« Reply #2 on: December 05, 2013, 12:41:55 PM »

What tutorial?
 ???
Logged

oranoron

  • Lieutenant
  • **
  • Posts: 85
    • View Profile
Re: What is a InstantiationException? Why is it happening to my spawn point?
« Reply #3 on: December 05, 2013, 12:47:35 PM »

http://fractalsoftworks.com/forum/index.php?topic=1282.0

It seems to be out of date now though because I keep getting the error code I've been getting and can't resolve it.
« Last Edit: December 05, 2013, 12:50:57 PM by oranoron »
Logged

oranoron

  • Lieutenant
  • **
  • Posts: 85
    • View Profile
Re: What is a InstantiationException? Why is it happening to my spawn point?
« Reply #4 on: December 05, 2013, 01:03:05 PM »

yeah I just finished double checking the entity token in my system gen file to make sure everything was consistent and to the best of my knowledge it was.
Logged

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7173
  • Harpoon Affectionado
    • View Profile
Re: What is a InstantiationException? Why is it happening to my spawn point?
« Reply #5 on: December 05, 2013, 01:19:43 PM »

Something is wrong with the instrumentalitySpawnPoint class. Unfortunately the error message doesn't give any more details. If you can't find anything, care to post it? I'm betting on a syntax error.
Logged

oranoron

  • Lieutenant
  • **
  • Posts: 85
    • View Profile
Re: What is a InstantiationException? Why is it happening to my spawn point?
« Reply #6 on: December 05, 2013, 01:21:26 PM »

I'm seriously about to quit this game altogether because of these idiotic error messages I am getting.

Spoiler
Caused by: java.lang.ClassNotFoundException: Compiling unit "data/scripts/world/instrumentalityGen.java"
   at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:212)
   at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:164)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
   ... 2 more
Caused by: org.codehaus.commons.compiler.CompileException: File data/scripts/world/instrumentalityGen.java, Line 100, Column 81: Unknown variable or type "token"
   at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:9403)
   at org.codehaus.janino.UnitCompiler.getType2(UnitCompiler.java:4951)
   at org.codehaus.janino.UnitCompiler.access$105(UnitCompiler.java:4950)
   at org.codehaus.janino.UnitCompiler$17.visitPackage(UnitCompiler.java:4700)
   at org.codehaus.janino.Java$Package.accept(Java.java:2238)
   at org.codehaus.janino.UnitCompiler.getType(UnitCompiler.java:4743)
   at org.codehaus.janino.UnitCompiler.getType2(UnitCompiler.java:4948)
   at org.codehaus.janino.UnitCompiler.access$135(UnitCompiler.java:4947)
   at org.codehaus.janino.UnitCompiler$17.visitAmbiguousName(UnitCompiler.java:4733)
   at org.codehaus.janino.Java$AmbiguousName.accept(Java.java:2223)
   at org.codehaus.janino.UnitCompiler.getType(UnitCompiler.java:4743)
   at org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:6968)
   at org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:5975)
   at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3797)
   at org.codehaus.janino.UnitCompiler.access$69(UnitCompiler.java:3721)
   at org.codehaus.janino.UnitCompiler$11.visitNewClassInstance(UnitCompiler.java:2978)
   at org.codehaus.janino.Java$NewClassInstance.accept(Java.java:2918)
   at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:2993)
   at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4017)
   at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3629)
   at org.codehaus.janino.UnitCompiler.access$63(UnitCompiler.java:3552)
   at org.codehaus.janino.UnitCompiler$11.visitMethodInvocation(UnitCompiler.java:2967)
   at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2831)
   at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:2993)
   at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4017)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2413)
   at org.codehaus.janino.UnitCompiler.access$38(UnitCompiler.java:2412)
   at org.codehaus.janino.UnitCompiler$8.visitMethodInvocation(UnitCompiler.java:2381)
   at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2831)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2407)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:1426)
   at org.codehaus.janino.UnitCompiler.access$8(UnitCompiler.java:1425)
   at org.codehaus.janino.UnitCompiler$5.visitExpressionStatement(UnitCompiler.java:926)
   at org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:1447)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:946)
   at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:972)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2083)
   at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:851)
   at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:832)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:528)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:421)
   at org.codehaus.janino.UnitCompiler$3.visitPackageMemberClassDeclaration(UnitCompiler.java:376)
   at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:765)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:383)
   at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:352)
   at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:210)
   ... 5 more
[close]

What the *** does it mean it doesn't understand the type token, it's the correct *** entity type to be using there. It appears in that place in every other spawn point reference I can find in every other gen file I've examined. What the hell does it want from me?
Logged

oranoron

  • Lieutenant
  • **
  • Posts: 85
    • View Profile
Re: What is a InstantiationException? Why is it happening to my spawn point?
« Reply #7 on: December 05, 2013, 01:23:15 PM »

Something is wrong with the instrumentalitySpawnPoint class. Unfortunately the error message doesn't give any more details. If you can't find anything, care to post it? I'm betting on a syntax error.

Here:

Spoiler
package data.scripts.world;

import com.fs.starfarer.api.campaign.CampaignFleetAPI;
import com.fs.starfarer.api.campaign.FleetAssignment;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;

public class instrumentalitySpawnPoint extends BaseSpawnPoint {

   public instrumentalitySpawnPoint(SectorAPI sector, LocationAPI location,
                     float daysInterval, int maxFleets, SectorEntityToken anchor) {
      super(sector, location, daysInterval, maxFleets, anchor);
   }

   @Override
   protected CampaignFleetAPI spawnFleet() {
      //if ((float) Math.random() < 0.5f) return null;
      
      String type = null;
      float r = (float) Math.random();
      if (r > .8f) {
         type = "instrumentality_scout";
      } else if (r > 0.50f) {
         type = "instrumentality_patrol";
      } else if (r > 0.35f) {
         type = "instrumentality_patrol2";
      } else if (r > 0.25f) {
         type = "instrumentality_attackfleet";
      } else if (r > 0.15f) {
         type = "instrumentality_defencefleet";
      }
      
      CampaignFleetAPI fleet = getSector().createFleet("instrumentality", type);
      getLocation().spawnFleet(getAnchor(), 0, 0, fleet);
      
      
      if (type.equals("instrumentality_scout") || type.equals("instrumentality_patrol") || type.equals("instrumentality_patrol2") || type.equals("instrumentality_attackfleet")) {
         fleet.addAssignment(FleetAssignment.RAID_SYSTEM, null, 10);
         fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);
      } else {
         if ((float) Math.random() > 0.5f) {
            fleet.addAssignment(FleetAssignment.RAID_SYSTEM, null, 30);
            fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);
         } else {
            fleet.addAssignment(FleetAssignment.DEFEND_LOCATION, getAnchor(), 20);
            fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);
         }
      }
      
      return fleet;
   }

}
[close]
Logged

Zaphide

  • Admiral
  • *****
  • Posts: 799
    • View Profile
Re: What is a InstantiationException? Why is it happening to my spawn point?
« Reply #8 on: December 05, 2013, 01:25:06 PM »

Well I know know what an Instantiation Exception is but it has not help me figure out why the game is rejecting my spawn point. I have it listed in the generators.csv, I have gone through and made sure my spelling has been consistent and I've followed the "How to get your faction into the game" tutorial as closely as I could for it being out of date. I still can't figure out what it is that is being rejected.

You probably shouldn't have a spawn point class (which I assume implements/extends spawnPointPlugin/baseSpawnPoint) listed in generators.csv.

Your exception is probably being thrown because (generally) spawnPoints won't have a default constructor (constructor with no parameters) and I suspect the way generators.csv loads the files listed in it is by attempting to call a default constructor.

EDIT:
Yes, you won't want that class listed in generators.csv.

Generally the class layout convention for most (campaign) mods follows:
MyModPlugin.java - calls generators (e.g MyGenerator.java)
MyGenerator.java - Adds game objects to the campaign (e.g MySpawnPoint.java)
MySpawnPoint.java - Contains data/logic for campaign object

It would probably be best to download some of the other mods on this forum and mimic their class structures :)

2ND EDIT:
I'll also add that using generators.csv is deprecated and it would be best to follow the ModPlugin approach.
« Last Edit: December 05, 2013, 01:31:20 PM by Zaphide »
Logged

Zaphide

  • Admiral
  • *****
  • Posts: 799
    • View Profile
Re: What is a InstantiationException? Why is it happening to my spawn point?
« Reply #9 on: December 05, 2013, 01:37:55 PM »

I'm seriously about to quit this game altogether because of these idiotic error messages I am getting.

Spoiler
Caused by: java.lang.ClassNotFoundException: Compiling unit "data/scripts/world/instrumentalityGen.java"
   at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:212)
   at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:164)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
   ... 2 more
Caused by: org.codehaus.commons.compiler.CompileException: File data/scripts/world/instrumentalityGen.java, Line 100, Column 81: Unknown variable or type "token"
   at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:9403)
   at org.codehaus.janino.UnitCompiler.getType2(UnitCompiler.java:4951)
   at org.codehaus.janino.UnitCompiler.access$105(UnitCompiler.java:4950)
   at org.codehaus.janino.UnitCompiler$17.visitPackage(UnitCompiler.java:4700)
   at org.codehaus.janino.Java$Package.accept(Java.java:2238)
   at org.codehaus.janino.UnitCompiler.getType(UnitCompiler.java:4743)
   at org.codehaus.janino.UnitCompiler.getType2(UnitCompiler.java:4948)
   at org.codehaus.janino.UnitCompiler.access$135(UnitCompiler.java:4947)
   at org.codehaus.janino.UnitCompiler$17.visitAmbiguousName(UnitCompiler.java:4733)
   at org.codehaus.janino.Java$AmbiguousName.accept(Java.java:2223)
   at org.codehaus.janino.UnitCompiler.getType(UnitCompiler.java:4743)
   at org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:6968)
   at org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:5975)
   at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3797)
   at org.codehaus.janino.UnitCompiler.access$69(UnitCompiler.java:3721)
   at org.codehaus.janino.UnitCompiler$11.visitNewClassInstance(UnitCompiler.java:2978)
   at org.codehaus.janino.Java$NewClassInstance.accept(Java.java:2918)
   at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:2993)
   at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4017)
   at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3629)
   at org.codehaus.janino.UnitCompiler.access$63(UnitCompiler.java:3552)
   at org.codehaus.janino.UnitCompiler$11.visitMethodInvocation(UnitCompiler.java:2967)
   at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2831)
   at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:2993)
   at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4017)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2413)
   at org.codehaus.janino.UnitCompiler.access$38(UnitCompiler.java:2412)
   at org.codehaus.janino.UnitCompiler$8.visitMethodInvocation(UnitCompiler.java:2381)
   at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2831)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2407)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:1426)
   at org.codehaus.janino.UnitCompiler.access$8(UnitCompiler.java:1425)
   at org.codehaus.janino.UnitCompiler$5.visitExpressionStatement(UnitCompiler.java:926)
   at org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:1447)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:946)
   at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:972)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2083)
   at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:851)
   at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:832)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:528)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:421)
   at org.codehaus.janino.UnitCompiler$3.visitPackageMemberClassDeclaration(UnitCompiler.java:376)
   at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:765)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:383)
   at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:352)
   at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:210)
   ... 5 more
[close]

What the *** does it mean it doesn't understand the type token, it's the correct *** entity type to be using there. It appears in that place in every other spawn point reference I can find in every other gen file I've examined. What the hell does it want from me?

There is no type of 'token'; it is SectorEntityToken. You will want to have code along the lines of:
Code
StarSystemAPI system = (StarSystemAPI)Global.getSector().getPlayerFleet().getContainingLocation(); // example, gets the players current star system
SectorEntityToken token = system.createToken(0, 0); // Creates a reusable token at the center of the system

Again, have a look at what other modders have done in their mods. It will make things a lot easier :)
Logged

oranoron

  • Lieutenant
  • **
  • Posts: 85
    • View Profile
Re: What is a InstantiationException? Why is it happening to my spawn point?
« Reply #10 on: December 05, 2013, 01:44:31 PM »

I'm seriously about to quit this game altogether because of these idiotic error messages I am getting.

Spoiler
Caused by: java.lang.ClassNotFoundException: Compiling unit "data/scripts/world/instrumentalityGen.java"
   at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:212)
   at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:164)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
   ... 2 more
Caused by: org.codehaus.commons.compiler.CompileException: File data/scripts/world/instrumentalityGen.java, Line 100, Column 81: Unknown variable or type "token"
   at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:9403)
   at org.codehaus.janino.UnitCompiler.getType2(UnitCompiler.java:4951)
   at org.codehaus.janino.UnitCompiler.access$105(UnitCompiler.java:4950)
   at org.codehaus.janino.UnitCompiler$17.visitPackage(UnitCompiler.java:4700)
   at org.codehaus.janino.Java$Package.accept(Java.java:2238)
   at org.codehaus.janino.UnitCompiler.getType(UnitCompiler.java:4743)
   at org.codehaus.janino.UnitCompiler.getType2(UnitCompiler.java:4948)
   at org.codehaus.janino.UnitCompiler.access$135(UnitCompiler.java:4947)
   at org.codehaus.janino.UnitCompiler$17.visitAmbiguousName(UnitCompiler.java:4733)
   at org.codehaus.janino.Java$AmbiguousName.accept(Java.java:2223)
   at org.codehaus.janino.UnitCompiler.getType(UnitCompiler.java:4743)
   at org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:6968)
   at org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:5975)
   at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3797)
   at org.codehaus.janino.UnitCompiler.access$69(UnitCompiler.java:3721)
   at org.codehaus.janino.UnitCompiler$11.visitNewClassInstance(UnitCompiler.java:2978)
   at org.codehaus.janino.Java$NewClassInstance.accept(Java.java:2918)
   at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:2993)
   at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4017)
   at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3629)
   at org.codehaus.janino.UnitCompiler.access$63(UnitCompiler.java:3552)
   at org.codehaus.janino.UnitCompiler$11.visitMethodInvocation(UnitCompiler.java:2967)
   at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2831)
   at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:2993)
   at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4017)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2413)
   at org.codehaus.janino.UnitCompiler.access$38(UnitCompiler.java:2412)
   at org.codehaus.janino.UnitCompiler$8.visitMethodInvocation(UnitCompiler.java:2381)
   at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2831)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2407)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:1426)
   at org.codehaus.janino.UnitCompiler.access$8(UnitCompiler.java:1425)
   at org.codehaus.janino.UnitCompiler$5.visitExpressionStatement(UnitCompiler.java:926)
   at org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:1447)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:946)
   at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:972)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2083)
   at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:851)
   at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:832)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:528)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:421)
   at org.codehaus.janino.UnitCompiler$3.visitPackageMemberClassDeclaration(UnitCompiler.java:376)
   at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:765)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:383)
   at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:352)
   at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:210)
   ... 5 more
[close]

What the *** does it mean it doesn't understand the type token, it's the correct *** entity type to be using there. It appears in that place in every other spawn point reference I can find in every other gen file I've examined. What the hell does it want from me?

There is no type of 'token'; it is SectorEntityToken. You will want to have code along the lines of:
Code
StarSystemAPI system = (StarSystemAPI)Global.getSector().getPlayerFleet().getContainingLocation(); // example, gets the players current star system
SectorEntityToken token = system.createToken(0, 0); // Creates a reusable token at the center of the system

Again, have a look at what other modders have done in their mods. It will make things a lot easier :)

I'm already doing that. As far as I can tell there isn't a single thing I'm not doing that those mods are but mine keep crashing.

My use of the term "token" is identical to how ValkyriaL has it in his and several other modders as well.

Edit: This is the instance of it causing a problem. Honestly I didn't feel to out of my league working on sprites, weapon and ship files but this has been a week of constantly failing to grasp what exactly it is I am doing and stumbling in through it.

Spoiler
      
system.addSpawnPoint(new instrumentalitySpawnPoint(sector, system, 14, 1, token, a2, instrumentalityStation));
[close]

I am literally at the point I am just trying to copy other files and replace instances referencing their files with mine and I still cant make it work.
« Last Edit: December 05, 2013, 01:51:37 PM by oranoron »
Logged

oranoron

  • Lieutenant
  • **
  • Posts: 85
    • View Profile
Re: What is a InstantiationException? Why is it happening to my spawn point?
« Reply #11 on: December 05, 2013, 02:00:34 PM »

This is the error my most recent attempt to fixing it has caused.

Spoiler
Caused by: org.codehaus.commons.compiler.CompileException: File data/scripts/world/instrumentalityGen.java, Line 104, Column 25: No applicable constructor/method found for actual parameters "com.fs.starfarer.api.campaign.SectorAPI, com.fs.starfarer.api.campaign.StarSystemAPI, int, int, com.fs.starfarer.api.campaign.SectorEntityToken, com.fs.starfarer.api.campaign.PlanetAPI, com.fs.starfarer.api.campaign.SectorEntityToken"; candidates are: "data.scripts.world.instrumentalitySpawnPoint(com.fs.starfarer.api.campaign.SectorAPI, com.fs.starfarer.api.campaign.LocationAPI, float, int, com.fs.starfarer.api.campaign.SectorEntityToken)"
   at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:9403)
   at org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:6994)
   at org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:5975)
   at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3797)
   at org.codehaus.janino.UnitCompiler.access$69(UnitCompiler.java:3721)
   at org.codehaus.janino.UnitCompiler$11.visitNewClassInstance(UnitCompiler.java:2978)
   at org.codehaus.janino.Java$NewClassInstance.accept(Java.java:2918)
   at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:2993)
   at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4017)
   at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3629)
   at org.codehaus.janino.UnitCompiler.access$63(UnitCompiler.java:3552)
   at org.codehaus.janino.UnitCompiler$11.visitMethodInvocation(UnitCompiler.java:2967)
   at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2831)
   at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:2993)
   at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4017)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2413)
   at org.codehaus.janino.UnitCompiler.access$38(UnitCompiler.java:2412)
   at org.codehaus.janino.UnitCompiler$8.visitMethodInvocation(UnitCompiler.java:2381)
   at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2831)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2407)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:1426)
   at org.codehaus.janino.UnitCompiler.access$8(UnitCompiler.java:1425)
   at org.codehaus.janino.UnitCompiler$5.visitExpressionStatement(UnitCompiler.java:926)
   at org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:1447)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:946)
   at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:972)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2083)
   at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:851)
   at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:832)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:528)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:421)
   at org.codehaus.janino.UnitCompiler$3.visitPackageMemberClassDeclaration(UnitCompiler.java:376)
   at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:765)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:383)
   at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:352)
   at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:210)
   ... 5 more
[close]
Logged

Zaphide

  • Admiral
  • *****
  • Posts: 799
    • View Profile
Re: What is a InstantiationException? Why is it happening to my spawn point?
« Reply #12 on: December 05, 2013, 02:11:34 PM »

This is the error my most recent attempt to fixing it has caused.

Spoiler
Caused by: org.codehaus.commons.compiler.CompileException: File data/scripts/world/instrumentalityGen.java, Line 104, Column 25: No applicable constructor/method found for actual parameters "com.fs.starfarer.api.campaign.SectorAPI, com.fs.starfarer.api.campaign.StarSystemAPI, int, int, com.fs.starfarer.api.campaign.SectorEntityToken, com.fs.starfarer.api.campaign.PlanetAPI, com.fs.starfarer.api.campaign.SectorEntityToken"; candidates are: "data.scripts.world.instrumentalitySpawnPoint(com.fs.starfarer.api.campaign.SectorAPI, com.fs.starfarer.api.campaign.LocationAPI, float, int, com.fs.starfarer.api.campaign.SectorEntityToken)"
   at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:9403)
   at org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:6994)
   at org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:5975)
   at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3797)
   at org.codehaus.janino.UnitCompiler.access$69(UnitCompiler.java:3721)
   at org.codehaus.janino.UnitCompiler$11.visitNewClassInstance(UnitCompiler.java:2978)
   at org.codehaus.janino.Java$NewClassInstance.accept(Java.java:2918)
   at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:2993)
   at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4017)
   at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3629)
   at org.codehaus.janino.UnitCompiler.access$63(UnitCompiler.java:3552)
   at org.codehaus.janino.UnitCompiler$11.visitMethodInvocation(UnitCompiler.java:2967)
   at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2831)
   at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:2993)
   at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4017)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2413)
   at org.codehaus.janino.UnitCompiler.access$38(UnitCompiler.java:2412)
   at org.codehaus.janino.UnitCompiler$8.visitMethodInvocation(UnitCompiler.java:2381)
   at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2831)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2407)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:1426)
   at org.codehaus.janino.UnitCompiler.access$8(UnitCompiler.java:1425)
   at org.codehaus.janino.UnitCompiler$5.visitExpressionStatement(UnitCompiler.java:926)
   at org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:1447)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:946)
   at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:972)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2083)
   at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:851)
   at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:832)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:528)
   at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:421)
   at org.codehaus.janino.UnitCompiler$3.visitPackageMemberClassDeclaration(UnitCompiler.java:376)
   at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:765)
   at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:383)
   at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:352)
   at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:210)
   ... 5 more
[close]

Well, this is caused by the method definition (in this case the constructor of instrumentalitySpawnPoint) not matching what you are attempting to pass into it.

As per your previous post the constructor definition is:
Code
public instrumentalitySpawnPoint(SectorAPI sector, LocationAPI location, float daysInterval, int maxFleets, SectorEntityToken anchor) 
note the types (SectorAPI, LocationAPI, float, int, SectorEntityToken).

It seems you are attempting to pass in (SectorAPI, StarSystemAPI, int, int, SectorEntityToken, PlanetAPI, SectorEntityToken).

Now StarSystemAPI extends LocationAPI so that is OK (you can use a StarSystemAPI object where it specifies a LocationAPI). Likewise, PlanetAPI extends SectorEntityToken.

I think you need to check where you are creating the instrumentalitySpawnPoint in your generator file and make sure that the objects you are attempting to pass to the constuctor are correct nin both number and types.
Logged

oranoron

  • Lieutenant
  • **
  • Posts: 85
    • View Profile
Re: What is a InstantiationException? Why is it happening to my spawn point?
« Reply #13 on: December 05, 2013, 02:15:22 PM »

Like I said as far as I can tell that has been exactly what I've been doing and I clearly lack the understanding to do so correctly on some fundamental level.

Everything I do just keeps making it worse. I'm not wasting any more of my time on this, I've put months of my free time into other parts of this mod and I really should have started with this because its dead locking me and I'm clearly incapable of understanding what it is I need to do to make this work. I've literally tried copying other gen and spawn point files and just changing all of the references from other people's stuff to mine and it still keeps giving me the same errors and I truly do not understand so that's it. I might come back to it in a while but as for now I don't see a point.
Logged

Zaphide

  • Admiral
  • *****
  • Posts: 799
    • View Profile
Re: What is a InstantiationException? Why is it happening to my spawn point?
« Reply #14 on: December 05, 2013, 02:19:33 PM »

Well, probably the best thing is to post the three files (or better yet a WIP of your mod). It is a little hard to work out what is wrong just from the error output alone :)
Logged
Pages: [1] 2