Hotfix Plain_GENERIC generating invalid java code
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Hotfix weird generation of Plain method in LinkageProcessor
Add Plain for eager instantiation if using custom linkages not generating link or unlink method
Dieser Commit ist enthalten in:
yoyosource 2022-09-25 11:55:45 +02:00
Ursprung d90938eff2
Commit 69c8ac3861
3 geänderte Dateien mit 25 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -279,7 +279,7 @@ public class LinkageProcessor extends AbstractProcessor {
linkages.computeIfAbsent(interfaceType.method(), s -> new ArrayList<>()).add(interfaceType);
}
}
if (!linkages.containsKey(plain_GENERIC.method())) {
if (linkages.size() == 1 && linkages.containsKey("unlink")) {
linkages.put(plain_GENERIC.method(), Collections.singletonList(plain_GENERIC));
}
return linkages;

Datei anzeigen

@ -0,0 +1,23 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.linkage.api;
public interface Plain {
}

Datei anzeigen

@ -34,6 +34,6 @@ public class Plain_GENERIC implements LinkageType {
@Override
public void generateCode(BuildPlan buildPlan, MethodBuilder method, String instance, TypeElement typeElement) {
method.addLine(instance + ";");
if (instance.startsWith("new ")) method.addLine(instance + ";");
}
}