#how do i debug in compiled classes instead of source

1 messages · Page 1 of 1 (latest)

modest basin
#

i have to debug all these CompletableFutures but i have no idea what they are because i cant tell at all, like its literlaly impossible to know whats happening, so maybe when they are all compiled into classes so i can see what all the method implementations are its easier? any other ideas?

abstract patrolBOT
#

<@&987246399047479336> please have a look, thanks.

abstract patrolBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

modest basin
#

like i need to see the object

#

but it just shows null for everything

crisp imp
modest basin
#

how do i know what the hell im loking at

#

idk

#

i have no idea what this is

#

but before they were regular classes i could make sense of

#

and they all got turned into completable futures

#

and now i cant make any sense of it

crisp imp
#

What did you do ?

modest basin
#

no like

#

some code converted them

crisp imp
#

What

modest basin
#

i didnt write this btw

#

im debugging

#

one of the lines like

#

did shit

crisp imp
#

?

modest basin
#

ill

#

hold on

#
for(final PreparableReloadListener preparablereloadlistener : pListeners) {
         final CompletableFuture<?> completablefuture1 = completablefuture;
         CompletableFuture<S> completablefuture2 = p_10812_.create(new PreparableReloadListener.PreparationBarrier() {
            public <T> CompletableFuture<T> wait(T p_10858_) {
               pGameExecutor.execute(() -> {
                  SimpleReloadInstance.this.preparingListeners.remove(preparablereloadlistener);
                  if (SimpleReloadInstance.this.preparingListeners.isEmpty()) {
                     SimpleReloadInstance.this.allPreparations.complete(Unit.INSTANCE);
                  }

               });
               return SimpleReloadInstance.this.allPreparations.thenCombine(completablefuture1, (p_10861_, p_10862_) -> {
                  return p_10858_;
               });
            }
         }, pResourceManager, preparablereloadlistener, (p_10842_) -> {
            this.startedTaskCounter.incrementAndGet();
            pBackgroundExecutor.execute(() -> {
               p_10842_.run();
               this.doneTaskCounter.incrementAndGet();
            });
         }, (p_10836_) -> {
            ++this.startedReloads;
            pGameExecutor.execute(() -> {
               p_10836_.run();
               ++this.finishedReloads;
            });
         });
         list.add(completablefuture2);
         completablefuture = completablefuture2;
      }```
abstract patrolBOT
# modest basin ```java for(final PreparableReloadListener preparablereloadlistener : pListeners...

Detected code, here are some useful tools:

Formatted code
for (final PreparableReloadListener preparablereloadlistener : pListeners) {
  final CompletableFuture<? > completablefuture1 = completablefuture;
  CompletableFuture<S> completablefuture2 = p_10812_.create(new PreparableReloadListener.PreparationBarrier() {
    public <T> CompletableFuture<T> wait(T p_10858_) {
      pGameExecutor.execute(() -> {
        SimpleReloadInstance.this .preparingListeners.remove(preparablereloadlistener);
        if (SimpleReloadInstance.this .preparingListeners.isEmpty()) {
          SimpleReloadInstance.this .allPreparations.complete(Unit.INSTANCE);
        }
      }
      );
      return SimpleReloadInstance.this .allPreparations.thenCombine(completablefuture1, (p_10861_, p_10862_) -> {
        return p_10858_;
      }
      );
    }
  }
  , pResourceManager, preparablereloadlistener, (p_10842_) -> {
    this .startedTaskCounter.incrementAndGet();
    pBackgroundExecutor.execute(() -> {
      p_10842_.run();
      this .doneTaskCounter.incrementAndGet();
    }
    );
  }
  , (p_10836_) -> {
    ++this .startedReloads;
    pGameExecutor.execute(() -> {
      p_10836_.run();
      ++this .finishedReloads;
    }
    );
  }
  );
  list.add(completablefuture2);
  completablefuture = completablefuture2;
}
modest basin
#

like

#

after that point i dont understand it

#

becuase i cant see what is waht

crisp imp
#

What are you trying to do

modest basin
#

like first the list looks like this

#

im trying to see what is going on

#

because i have to change the order of that list

#

i need to move the DucLib ones (those are the only ones that i created) to be executed before the EntityModelSet one

crisp imp
#

What is this list

modest basin
#

so i want to run thru the code to see what happens, but its like not possible to understand

crisp imp
#

How does it change

modest basin
#

look

modest basin
modest basin
crisp imp
#

What is this list ?

modest basin
#

so i dont know what is what

#

reload listeners in minecraft

#

i need to change the order

#

so im just seeing how they work

crisp imp
#

You probably can't

modest basin
#

like

#

there is also this

#

this.allDone = Util.sequenceFailFast(list);

#

i think that changes th eorde

modest basin
crisp imp
modest basin
#

public static <V> CompletableFuture<List<V>> sequenceFailFast(List<? extends CompletableFuture<? extends V>> pCompletableFutures) {
CompletableFuture<List<V>> completablefuture = new CompletableFuture<>();
return fallibleSequence(pCompletableFutures, completablefuture::completeExceptionally).applyToEither(completablefuture, Function.identity());
}

#
private static <V> CompletableFuture<List<V>> fallibleSequence(List<? extends CompletableFuture<? extends V>> p_214632_, Consumer<Throwable> p_214633_) {
      List<V> list = Lists.newArrayListWithCapacity(p_214632_.size());
      CompletableFuture<?>[] completablefuture = new CompletableFuture[p_214632_.size()];
      p_214632_.forEach((p_214641_) -> {
         int i = list.size();
         list.add((V)null);
         completablefuture[i] = p_214641_.whenComplete((p_214650_, p_214651_) -> {
            if (p_214651_ != null) {
               p_214633_.accept(p_214651_);
            } else {
               list.set(i, p_214650_);
            }

         });
      });
      return CompletableFuture.allOf(completablefuture).thenApply((p_214626_) -> {
         return list;
      });
   }```
abstract patrolBOT
# modest basin ```java private static <V> CompletableFuture<List<V>> fallibleSequence(List<? ex...

Detected code, here are some useful tools:

Formatted code
private static <V> CompletableFuture<List<V>> fallibleSequence(List<?  extends CompletableFuture<?  extends V>> p_214632_, Consumer<Throwable> p_214633_) {
  List<V> list = Lists.newArrayListWithCapacity(p_214632_.size());
  CompletableFuture<? > [] completablefuture = new CompletableFuture[p_214632_.size() ] ;
  p_214632_.forEach((p_214641_) -> {
    int i = list.size();
    list.add((V) null );
    completablefuture[i]  = p_214641_.whenComplete((p_214650_, p_214651_) -> {
      if (p_214651_ != null ) {
        p_214633_.accept(p_214651_);
      }
      else {
        list.set(i, p_214650_);
      }
    }
    );
  }
  );
  return CompletableFuture.allOf(completablefuture).thenApply((p_214626_) -> {
    return list;
  }
  );
}
modest basin
#
public static <V> CompletableFuture<List<V>> sequenceFailFast(List<? extends CompletableFuture<? extends V>> pCompletableFutures) {
      CompletableFuture<List<V>> completablefuture = new CompletableFuture<>();
      return fallibleSequence(pCompletableFutures, completablefuture::completeExceptionally).applyToEither(completablefuture, Function.identity());
   }```
abstract patrolBOT
# modest basin ```java public static <V> CompletableFuture<List<V>> sequenceFailFast(List<? ext...

Detected code, here are some useful tools:

Formatted code
public static <V> CompletableFuture<List<V>> sequenceFailFast(List<?  extends CompletableFuture<?  extends V>> pCompletableFutures) {
  CompletableFuture<List<V>> completablefuture = new CompletableFuture<>();
  return fallibleSequence(pCompletableFutures, completablefuture::completeExceptionally).applyToEither(completablefuture, Function.identity());
}
modest basin
#

but i dont understand this at all

#

like

#

how can i see what class it is

#

what is even the point of the completablefuture it just makes it impossible to understand

#

like is the order changed?

#

or not?

crisp imp
#

A future is something that will be executed in the future

#

The order is not changed as far as I see

modest basin
#

oh

#

okay good

#

becuase sequenceFailFast

#

sounds like it changes the order

#

just going off of the name

crisp imp
#

It keeps the same order

modest basin
#

so how do i find where they get executed?

#

what method in CompletableFuture do you run for that?

crisp imp
#

It's not where it's when

modest basin
#

0.o

#

is it like timed?

#

its not like a Runnable?

crisp imp
#

Wdym

#

It's a future

modest basin
#

idk how a future works

crisp imp
#

It just tell you when something is exeuted

modest basin
#

so you dont execute it thru the future?

crisp imp
#

Do you know executors ?

modest basin
#

no

crisp imp
#

Ah

modest basin
#

oh i found it

crisp imp
#

Basically a future will tell you the state of the code you will execute

modest basin
#

oh ye this is an executer that gets ran

#

so the list of executors is the thing that matters