HackerTrans
TopNewTrendsCommentsPastAskShowJobs

sedro

no profile record

comments

sedro
·vor 9 Monaten·discuss
That's another gotcha-- interning of strings and boxed primitives.

Are there linters for this sort of thing? I don't write Java much any more.
sedro
·vor 9 Monaten·discuss
Autoboxing's evil twin, auto-unboxing should knock the score down a few points.

  Integer a = null;
  int b = 42;
  if (a == b) {} // throws NullPointerException
sedro
·letztes Jahr·discuss
It's useful and very common to use. For example, you could concatenate together command-line argument flags that may or may not be present.
sedro
·vor 2 Jahren·discuss
A separate VLAN, if your router is capable
sedro
·vor 2 Jahren·discuss
The PDF metadata says it's PyPDF2
sedro
·vor 2 Jahren·discuss
It does! Code is here https://github.com/java-native-access/jna/blob/40f0a1249b5ad...
sedro
·vor 2 Jahren·discuss
That's how java.io.File#deleteOnExit works under the hood. The DLL is still loaded at that point and can't be deleted.
sedro
·vor 2 Jahren·discuss
According to JNA it's not safe to unload the DLL:

https://github.com/java-native-access/jna/blob/40f0a1249b5ad...

  Do NOT force the class loader to unload the native library, since
  that introduces issues with cleaning up any extant JNA bits
  (e.g. Memory) which may still need use of the library before shutdown.
Following the blame back to 2011, they did unload DLLs before https://github.com/java-native-access/jna/commit/71de662675b...

  Remove any automatically unpacked native library.  Forcing the class
  loader to unload it first is only required on Windows, since the
  temporary native library is still "in use" and can't be deleted until
  the native library is removed from its class loader.  Any deferred
  execution we might install at this point would prevent the Native
  class and its class loader from being GC'd, so we instead force 
  the native library unload just a little bit prematurely.
Users reported occasional access violation errors during shutdown.
sedro
·vor 2 Jahren·discuss
You would also need to learn about Maven profiles and activation. And for other build tools, you'll be delighted to know they have partial support.
sedro
·vor 2 Jahren·discuss
This wouldn't work on Windows, because you can't delete a DLL while it's in use
sedro
·vor 2 Jahren·discuss
Native libraries are typically packaged inside a jar so that everything works over the existing build and dependency management systems.

For example, each these jars named "native-$os-$arch.jar" contain a .dll/.so/.dylib: https://repo1.maven.org/maven2/com/aayushatharva/brotli4j/

JNA will extract the appropriate native library (using os.name and os.arch system properties), save the library to a temp file, then load it.
sedro
·vor 2 Jahren·discuss
> I can't think of another statically typed language that screws this up so badly. It just keeps getting worse with stuff like Optional and @NotNull.

Java might be the only language where a simple assignment `x = y` can throw a NullPointerException (due to auto-unboxing)
sedro
·vor 3 Jahren·discuss
Or more succinctly

  val num = words.count(_.nonEmpty)
sedro
·vor 3 Jahren·discuss
This cheatsheet would have you publish dist/*.{js,d.ts}. Presumably you would use "files":["dist"] in package.json to exclude sources from being published.

The OP recommends to additionally package src/*.ts along with sourceMaps and declarationMaps.

What's actually the best practice here?