Git Product home page Git Product logo

Comments (4)

HelloCoCooo avatar HelloCoCooo commented on September 23, 2024

Code snippet of com.google.gson.stream.JsonReader.nextInt in me.clip:placeholderapi:2.9.2 (shadowed but expected to invoke method):

//line 870
if (p == 16) {
  this.peekedString = new String(this.buffer, this.pos, this.peekedNumberLength);
  this.pos += this.peekedNumberLength;
} else if (p == 8 || p == 9 || p == 10) {
  if (p == 10) {
    this.peekedString = nextUnquotedValue();
  } else {
    this.peekedString = nextQuotedValue((p == 8) ? 39 : 34);
  } 
  try {
    int result = Integer.parseInt(this.peekedString);
    this.peeked = 0;
    this.pathIndices[this.stackSize - 1] = this.pathIndices[this.stackSize - 1] + 1;
    return result;
  } catch (NumberFormatException numberFormatException) {}
}

Code snippet of com.google.gson.stream.JsonReader.nextInt in com.google.code.gson:gson:2.2.4 (loaded version):

//line 841
if (p == 16) {
  this.peekedString = new String(this.buffer, this.pos, this.peekedNumberLength);
  this.pos += this.peekedNumberLength;
} else {
  if (p != 8 && p != 9) {
    throw new IllegalStateException("Expected an int but was " + this.peek() + " at line " + this.getLineNumber() + " column " + this.getColumnNumber());
  }

  this.peekedString = this.nextQuotedValue((char)(p == 8 ? '\'' : '"'));

  try {
    result = Integer.parseInt(this.peekedString);
    this.peeked = 0;
    return result;
  } catch (NumberFormatException var5) {
  }
}

As a result, these conflicting method included in me.clip:placeholderapi:2.9.2 deals with different cases, which changes the control flows and data flows. So being forced to use these methods in com.google.code.gson:gson:2.2.4 may lead to inconsisitent semantic behaviors.

from chestcommands.

HelloCoCooo avatar HelloCoCooo commented on September 23, 2024

@filoghost May I pull a request to fix it?

from chestcommands.

filoghost avatar filoghost commented on September 23, 2024

Hello, thank you very much for the in-depth analysis, sorry if I only answer now. I think it's quite bad that PlaceholderAPI includes a common library, especially one that already ships with Spigot, without relocating it.

However, I don't understand why is this dependency order important, since ChestCommands doesn't call com.google.gson.stream.JsonReader.nextInt (the method you mentioned). The dependency order is not important during runtime (it will not affect class loading). Is it relevant only for other plugins using ChestCommands through Maven?

from chestcommands.

filoghost avatar filoghost commented on September 23, 2024

@HelloCoCooo why did you close this?

from chestcommands.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.