Skip to content

Commit

Permalink
Fix SearchResult::next, add OriginallySynthetic, misc
Browse files Browse the repository at this point in the history
  • Loading branch information
unascribed committed Feb 12, 2023
1 parent d7fc87b commit 11a8dc8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ targetCompatibility = 8

group = "com.unascribed"
archivesBaseName = "NilLoader"
version = "1.3.1"
version = "1.3.2"

tasks.withType(JavaCompile) {
options.release = 8
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/nilloader/NilAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ public static void registerTransformer(ClassTransformer transformer) {

public static void setTargetMapping(String mod, String id) {
if (mod == null) throw new IllegalStateException("Can only call this method during an entrypoint");
if (frozen) throw new IllegalStateException("Mappings must be set during the premain entrypoint");
if (frozen) throw new IllegalStateException("Mappings must be set during the premain/hijack entrypoint");
activeModMappings.put(mod, id);
}

Expand Down
19 changes: 19 additions & 0 deletions src/main/java/nilloader/annotate/OriginallySynthetic.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package nilloader.annotate;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.CLASS;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

/**
* Marks a member or class as having originally been marked as synthetic, but it was untagged by
* NilGradle's remapping to allow it to be referenced in source code.
*/
@Retention(CLASS)
@Target({ TYPE, FIELD, METHOD })
@Documented
public @interface OriginallySynthetic {}
2 changes: 1 addition & 1 deletion src/main/java/nilloader/api/lib/mini/PatchContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void jumpBefore() {
public SearchResult next() {
assertSuccessful();
assertValid();
return searchFrom(reverse ? code.indexOf(start) : code.indexOf(end), query, reverse);
return searchFrom(reverse ? code.indexOf(start) : code.indexOf(end)+1, query, reverse);
}

/**
Expand Down

0 comments on commit 11a8dc8

Please sign in to comment.