question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BlockManager returns Air block instead of null for block family if no side is defined

See original GitHub issue

To test, inject a BlockManager in a test system, activate the core module and inspect blockManager.getBlock("core:BirchTrunk:engine:stair"). This call is missing the side parameter for the family rotation, e.g. blockManager.getBlock("core:BirchTrunk:engine:stair.LEFT") gives a correct rotated stair. But instead of logging an error or returning null, this silently returns an Air block 😒 .

Tow classes on issue here: HorizontalBlockFamily.getBlockFor(BlockUri) does not log an warning when the side can not be parsed, returning null may be okay.

BlockManager.getBlock(BlockUri) returns null if the block can not be found directly but an air block if the block is not directly registered, part of a family and the family returns null for the block. This should really return null as the javadoc says: Retrieves the Block for the given uri, or null if there isn't one.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:21 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
vampcatcommented, Feb 9, 2018

I vote for Optional.

If the goal is to make the most efficient code we possibly can, we should switch to C++ (or assembly). However, the goal is to make a easy-to-approach, extensible platform. Which is why I vote in favour of cleaner code, even if it means slight performance hit. (Note that gestalt uses Optionals almost exclusively, so any and every cost associated with Optionals is already being borne by us.)

1reaction
OvermindDL1commented, Oct 20, 2017

I personally really like Scala, it does its typing system Right, but it is not really ‘first-class’ in that it is not native on anything yet, has to be separate. Kotlin is more of a very simplified Scala, lacks the nice typing features of Scala so you cannot generate, say, super-optimized code (like primitive containers and such), but it is more of a Java Done Right, but the big point of it is that it is First-Class on Android, and if it is first class there (the largest JVM ecosystem) and the largest Java IDE (IntelliJ) includes Kotlin by default for the desktop, it is likely to say that it has become pretty ubiquitous (didn’t Kotlin even take over Java in the last few months as the most used JVM language on android?). Scala’s code generation is absolutely top notch though… hard to ignore that…

But yeah, Scala and Kotlin and Java can all interoperate fine in all ways without cost (unlike groovy and such).

There shouldn’t be any hoops to jump through if Scala/Kotlin is added to the base engine’s gradle file, it will set up the scala/kotlin for whatever IDE they use anyway.

Read more comments on GitHub >

github_iconTop Results From Across the Web

kotlin - How do I run a block of code if a nullable type is null?
Here's a concise syntax using the Elvis operator. Recall the Elvis operator only executes the right side if the left side ...
Read more >
Understanding null safety - Dart
If you run this Dart program without null safety, it throws a NoSuchMethodError exception on the call to .length . The null value...
Read more >
US 10,110,573 B2 - Packet-processing with CPPI DMA streaming ...
A packet-processing electronic subsystem comprising: (a) a first ingress port having a data input and a data output; (b) a second ingress port...
Read more >
Backup patent application class
When block data and its address are input through a fiber channel port, ... Once the backup drive is installed, the machine returns...
Read more >
Null safety - Kotlin
Nullable types and non-null types · An explicit call to throw NullPointerException() . · Usage of the !! operator that is described below....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found