Any plans for making any of these expressions cons...
# announcements
m
Any plans for making any of these expressions constant?
Copy code
companion object {
   const val TAG1 = this.javaClass.simpleName
   const val TAG2 = MainActivity::class.simpleName!!
}
Obfuscation mangles class names so having them assigned to constants before obfuscation pass would be greatly useful. (Or is there a way to this that I'm missing)
n
That would be confusing for use cases when you actually need the obfuscated class names
m
Just skip
const
and they will be obfuscated
Properties the value of which is known at compile time can be marked as compile time constants using the
const
modifier
Obfuscation is done post-compilation, so `const val`s should have non-obfuscated names and `val`s should have obfusacted names. Am I getting this right?
k
That's pretty shady, I would expect the
const
qualifier to not actually change the value of things.
☝️ 1
1
m
this is probably the only scenario where it actually changes behavior from regular
var
k
Yes, and that's the problem.
m
I don't see it as a problem, obfuscation changes classes and this just "avoids" obfuscation's change
Isn't this exact scenario where
const
should be used? Other than optimizations
n
No,
const
is only used as an optimization. It should never change the variable value.
m
but
const
isn't changing the value, it's the obfuscator.
const
just inlines the value as the documentation says.