You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Ben Weidig <be...@netzgut.net> on 2022/05/28 14:40:34 UTC

Adding @InjectComponent(optional = true) to complement @DisableStrictChecks

Hello!

As discussed in a previous thread, I've created an issue for adding
"boolean optional() default false" to @InjectComponent to complement
@DisableStrictChecks.

https://issues.apache.org/jira/projects/TAP5/issues/TAP5-2727

The ticket contains a patch with an attempt to implement the required
behavior, plus some tests.
If optional() == true, the InjectComponentWorker just ignores the
UnknownValueException and the embedded component will be null.

That was the easiest way to implement it.
Another option would be creating a proxy in case of an optional and missing
component, which reacts with an appropriate Exception if used.
Or do you think that's overkill?
Like @DisableStrictChecks, it's more of an advanced use case.

Cheers,
Ben

Re: Adding @InjectComponent(optional = true) to complement @DisableStrictChecks

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, Jun 3, 2022 at 4:08 AM Ben Weidig <be...@netzgut.net> wrote:
> Weird, I never had an issue with GitHub, the accounts are linked correctly
> with Apache.

Weird indeed. They're supposed to be in bidirectional synchronization.
Maybe a temporary glitch?

> But I'll switch to Gitbox if using GitHub could cause issues for others.
> In the end, it doesn't matter which one I use.

I don't think you need to switch right now. Keep working on GitHub and
just switch if this problem (which I solved quickly anyway once I knew
what I had to do, or maybe it even solved itself) if the problem keeps
happening.

> I've just thought about @InjectComponent(optional) and
> @DisableStrictChecks, and how it's also useful for multiple resource axis.
> Maybe I should write a little guide for the website after its release on
> how to use the new features and what possible use-cases are.

Great idea!
>
> Cheers!
> Ben
>
> On Fri, Jun 3, 2022 at 2:07 AM Thiago H. de Paula Figueiredo <
> thiagohp@gmail.com> wrote:
>
> > I fixed the gitbox/GitHub issue.
> >
> > On Thu, Jun 2, 2022 at 7:13 PM Thiago H. de Paula Figueiredo
> > <th...@gmail.com> wrote:
> > >
> > > On Wed, Jun 1, 2022 at 3:36 AM Ben Weidig <be...@netzgut.net> wrote:
> > >
> > > > Hi Thiago,
> > >
> > > Hello!
> > >
> > > > I always forget about making a new branch, I'll try to do that in the
> > > > future for non-trivial changes!
> > >
> > > Yeah, it usually makes everything easier to manage. :)
> > >
> > > > TAP5-2727 is pushed in masters now.
> > >
> > > Thanks! But have you pushed to the repository in GitHub directly,
> > > without going through gitbox.apache.org? Or maybe the ASF mirroring
> > > isn't working? I'm trying to commit something and I'm getting this:
> > >
> > > thiago@ars-desktop ~/w/tapestry-5 (master)> git push
> > > Username for 'https://gitbox.apache.org': thiagohp
> > > Password for 'https://thiagohp@gitbox.apache.org':
> > > Enumerating objects: 23, done.
> > > Counting objects: 100% (23/23), done.
> > > Delta compression using up to 8 threads
> > > Compressing objects: 100% (19/19), done.
> > > Writing objects: 100% (23/23), 6.29 KiB | 6.29 MiB/s, done.
> > > Total 23 (delta 4), reused 0 (delta 0), pack-reused 0
> > > remote: To github:apache/tapestry-5.git
> > > remote:  ! [rejected]
> > > 227b29507c3ebd9cbcacae0e77df17fe4e41cbcc -> master (fetch first)
> > > remote: error: failed to push some refs to 'git@github
> > :apache/tapestry-5.git'
> > > remote: hint: Updates were rejected because the remote contains work
> > that you do
> > > remote: hint: not have locally. This is usually caused by another
> > > repository pushing
> > > remote: hint: to the same ref. You may want to first integrate the
> > > remote changes
> > > remote: hint: (e.g., 'git pull ...') before pushing again.
> > > remote: hint: See the 'Note about fast-forwards' in 'git push --help'
> > > for details.
> > > remote: Syncing refs/heads/master...
> > > remote: Could not sync with GitHub:
> > > remote: Error running update hook:
> > /x1/gitbox/hooks/update.d/01-sync-repo.py
> > > remote: error: hook declined to update refs/heads/master
> > > To https://gitbox.apache.org/repos/asf/tapestry-5.git
> > >  ! [remote rejected]     master -> master (hook declined)
> > > error: failed to push some refs to
> > > 'https://gitbox.apache.org/repos/asf/tapestry-5.git'
> > >
> > > I see the GitHub repository, which is supposed to be a mirror, 1
> > > commit ahead of the gitbox repository. And the canonical repository is
> > > the gitbox one.
> > >
> > > > Yeah, it's great to see so much activity and new features and
> > improvements!
> > >
> > > It sure is!
> > >
> > > Cheers!
> > >
> > > --
> > > Thiago
> >
> >
> >
> > --
> > Thiago
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: dev-help@tapestry.apache.org
> >
> >



-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Adding @InjectComponent(optional = true) to complement @DisableStrictChecks

Posted by Ben Weidig <be...@netzgut.net>.
Weird, I never had an issue with GitHub, the accounts are linked correctly
with Apache.
But I'll switch to Gitbox if using GitHub could cause issues for others.
In the end, it doesn't matter which one I use.

I've just thought about @InjectComponent(optional) and
@DisableStrictChecks, and how it's also useful for multiple resource axis.
Maybe I should write a little guide for the website after its release on
how to use the new features and what possible use-cases are.

Cheers!
Ben

On Fri, Jun 3, 2022 at 2:07 AM Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> I fixed the gitbox/GitHub issue.
>
> On Thu, Jun 2, 2022 at 7:13 PM Thiago H. de Paula Figueiredo
> <th...@gmail.com> wrote:
> >
> > On Wed, Jun 1, 2022 at 3:36 AM Ben Weidig <be...@netzgut.net> wrote:
> >
> > > Hi Thiago,
> >
> > Hello!
> >
> > > I always forget about making a new branch, I'll try to do that in the
> > > future for non-trivial changes!
> >
> > Yeah, it usually makes everything easier to manage. :)
> >
> > > TAP5-2727 is pushed in masters now.
> >
> > Thanks! But have you pushed to the repository in GitHub directly,
> > without going through gitbox.apache.org? Or maybe the ASF mirroring
> > isn't working? I'm trying to commit something and I'm getting this:
> >
> > thiago@ars-desktop ~/w/tapestry-5 (master)> git push
> > Username for 'https://gitbox.apache.org': thiagohp
> > Password for 'https://thiagohp@gitbox.apache.org':
> > Enumerating objects: 23, done.
> > Counting objects: 100% (23/23), done.
> > Delta compression using up to 8 threads
> > Compressing objects: 100% (19/19), done.
> > Writing objects: 100% (23/23), 6.29 KiB | 6.29 MiB/s, done.
> > Total 23 (delta 4), reused 0 (delta 0), pack-reused 0
> > remote: To github:apache/tapestry-5.git
> > remote:  ! [rejected]
> > 227b29507c3ebd9cbcacae0e77df17fe4e41cbcc -> master (fetch first)
> > remote: error: failed to push some refs to 'git@github
> :apache/tapestry-5.git'
> > remote: hint: Updates were rejected because the remote contains work
> that you do
> > remote: hint: not have locally. This is usually caused by another
> > repository pushing
> > remote: hint: to the same ref. You may want to first integrate the
> > remote changes
> > remote: hint: (e.g., 'git pull ...') before pushing again.
> > remote: hint: See the 'Note about fast-forwards' in 'git push --help'
> > for details.
> > remote: Syncing refs/heads/master...
> > remote: Could not sync with GitHub:
> > remote: Error running update hook:
> /x1/gitbox/hooks/update.d/01-sync-repo.py
> > remote: error: hook declined to update refs/heads/master
> > To https://gitbox.apache.org/repos/asf/tapestry-5.git
> >  ! [remote rejected]     master -> master (hook declined)
> > error: failed to push some refs to
> > 'https://gitbox.apache.org/repos/asf/tapestry-5.git'
> >
> > I see the GitHub repository, which is supposed to be a mirror, 1
> > commit ahead of the gitbox repository. And the canonical repository is
> > the gitbox one.
> >
> > > Yeah, it's great to see so much activity and new features and
> improvements!
> >
> > It sure is!
> >
> > Cheers!
> >
> > --
> > Thiago
>
>
>
> --
> Thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>

Re: Adding @InjectComponent(optional = true) to complement @DisableStrictChecks

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
I fixed the gitbox/GitHub issue.

On Thu, Jun 2, 2022 at 7:13 PM Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
>
> On Wed, Jun 1, 2022 at 3:36 AM Ben Weidig <be...@netzgut.net> wrote:
>
> > Hi Thiago,
>
> Hello!
>
> > I always forget about making a new branch, I'll try to do that in the
> > future for non-trivial changes!
>
> Yeah, it usually makes everything easier to manage. :)
>
> > TAP5-2727 is pushed in masters now.
>
> Thanks! But have you pushed to the repository in GitHub directly,
> without going through gitbox.apache.org? Or maybe the ASF mirroring
> isn't working? I'm trying to commit something and I'm getting this:
>
> thiago@ars-desktop ~/w/tapestry-5 (master)> git push
> Username for 'https://gitbox.apache.org': thiagohp
> Password for 'https://thiagohp@gitbox.apache.org':
> Enumerating objects: 23, done.
> Counting objects: 100% (23/23), done.
> Delta compression using up to 8 threads
> Compressing objects: 100% (19/19), done.
> Writing objects: 100% (23/23), 6.29 KiB | 6.29 MiB/s, done.
> Total 23 (delta 4), reused 0 (delta 0), pack-reused 0
> remote: To github:apache/tapestry-5.git
> remote:  ! [rejected]
> 227b29507c3ebd9cbcacae0e77df17fe4e41cbcc -> master (fetch first)
> remote: error: failed to push some refs to 'git@github:apache/tapestry-5.git'
> remote: hint: Updates were rejected because the remote contains work that you do
> remote: hint: not have locally. This is usually caused by another
> repository pushing
> remote: hint: to the same ref. You may want to first integrate the
> remote changes
> remote: hint: (e.g., 'git pull ...') before pushing again.
> remote: hint: See the 'Note about fast-forwards' in 'git push --help'
> for details.
> remote: Syncing refs/heads/master...
> remote: Could not sync with GitHub:
> remote: Error running update hook: /x1/gitbox/hooks/update.d/01-sync-repo.py
> remote: error: hook declined to update refs/heads/master
> To https://gitbox.apache.org/repos/asf/tapestry-5.git
>  ! [remote rejected]     master -> master (hook declined)
> error: failed to push some refs to
> 'https://gitbox.apache.org/repos/asf/tapestry-5.git'
>
> I see the GitHub repository, which is supposed to be a mirror, 1
> commit ahead of the gitbox repository. And the canonical repository is
> the gitbox one.
>
> > Yeah, it's great to see so much activity and new features and improvements!
>
> It sure is!
>
> Cheers!
>
> --
> Thiago



-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Adding @InjectComponent(optional = true) to complement @DisableStrictChecks

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, Jun 1, 2022 at 3:36 AM Ben Weidig <be...@netzgut.net> wrote:

> Hi Thiago,

Hello!

> I always forget about making a new branch, I'll try to do that in the
> future for non-trivial changes!

Yeah, it usually makes everything easier to manage. :)

> TAP5-2727 is pushed in masters now.

Thanks! But have you pushed to the repository in GitHub directly,
without going through gitbox.apache.org? Or maybe the ASF mirroring
isn't working? I'm trying to commit something and I'm getting this:

thiago@ars-desktop ~/w/tapestry-5 (master)> git push
Username for 'https://gitbox.apache.org': thiagohp
Password for 'https://thiagohp@gitbox.apache.org':
Enumerating objects: 23, done.
Counting objects: 100% (23/23), done.
Delta compression using up to 8 threads
Compressing objects: 100% (19/19), done.
Writing objects: 100% (23/23), 6.29 KiB | 6.29 MiB/s, done.
Total 23 (delta 4), reused 0 (delta 0), pack-reused 0
remote: To github:apache/tapestry-5.git
remote:  ! [rejected]
227b29507c3ebd9cbcacae0e77df17fe4e41cbcc -> master (fetch first)
remote: error: failed to push some refs to 'git@github:apache/tapestry-5.git'
remote: hint: Updates were rejected because the remote contains work that you do
remote: hint: not have locally. This is usually caused by another
repository pushing
remote: hint: to the same ref. You may want to first integrate the
remote changes
remote: hint: (e.g., 'git pull ...') before pushing again.
remote: hint: See the 'Note about fast-forwards' in 'git push --help'
for details.
remote: Syncing refs/heads/master...
remote: Could not sync with GitHub:
remote: Error running update hook: /x1/gitbox/hooks/update.d/01-sync-repo.py
remote: error: hook declined to update refs/heads/master
To https://gitbox.apache.org/repos/asf/tapestry-5.git
 ! [remote rejected]     master -> master (hook declined)
error: failed to push some refs to
'https://gitbox.apache.org/repos/asf/tapestry-5.git'

I see the GitHub repository, which is supposed to be a mirror, 1
commit ahead of the gitbox repository. And the canonical repository is
the gitbox one.

> Yeah, it's great to see so much activity and new features and improvements!

It sure is!

Cheers!

-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Adding @InjectComponent(optional = true) to complement @DisableStrictChecks

Posted by Ben Weidig <be...@netzgut.net>.
Hi Thiago,

I always forget about making a new branch, I'll try to do that in the
future for non-trivial changes!
TAP5-2727 is pushed in masters now.
But if any issues arise, I got the time to fix them.

Regarding the 5.8.3, I'll answer in the other thread.

Yeah, it's great to see so much activity and new features and improvements!

Cheers
Ben

On Tue, May 31, 2022 at 2:09 PM Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Sat, May 28, 2022 at 11:40 AM Ben Weidig <be...@netzgut.net> wrote:
>
> > Hello!
>
> Hi!
>
> > As discussed in a previous thread, I've created an issue for adding
> > "boolean optional() default false" to @InjectComponent to complement
> > @DisableStrictChecks.
> >
> > https://issues.apache.org/jira/projects/TAP5/issues/TAP5-2727
> >
> > The ticket contains a patch with an attempt to implement the required
> > behavior, plus some tests.
> > If optional() == true, the InjectComponentWorker just ignores the
> > UnknownValueException and the embedded component will be null.
> > That was the easiest way to implement it.
>
> After reading your message above and the patch, it gets a +1 from me.
> By the way, feel free to create branches for new features like this.
> It has one very nice bonus: Travis CI automatically runs tests on any
> branches: https://app.travis-ci.com/github/apache/tapestry-5/branches.
> This way, you can be sure you won't break anything before merging to
> master while still being able to have Git to store and version your
> changes.
>
> > Another option would be creating a proxy in case of an optional and
> missing
> > component, which reacts with an appropriate Exception if used.
> > Or do you think that's overkill?
>
> I believe it is overkill. In addition, you can just check for null
> instead of having to have a try/catch in order to know whether the
> injected component exists or not.
>
> Thank you for suggesting and implementing this! I really, really love
> all the activity we're having on Tapestry's repository lately. :)
>
> Also, I'd like to cut 5.8.3 soon to get CORS and everything else out
> there. Thoughts?
>
> Cheers!
>
> --
> Thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>

Re: Adding @InjectComponent(optional = true) to complement @DisableStrictChecks

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sat, May 28, 2022 at 11:40 AM Ben Weidig <be...@netzgut.net> wrote:

> Hello!

Hi!

> As discussed in a previous thread, I've created an issue for adding
> "boolean optional() default false" to @InjectComponent to complement
> @DisableStrictChecks.
>
> https://issues.apache.org/jira/projects/TAP5/issues/TAP5-2727
>
> The ticket contains a patch with an attempt to implement the required
> behavior, plus some tests.
> If optional() == true, the InjectComponentWorker just ignores the
> UnknownValueException and the embedded component will be null.
> That was the easiest way to implement it.

After reading your message above and the patch, it gets a +1 from me.
By the way, feel free to create branches for new features like this.
It has one very nice bonus: Travis CI automatically runs tests on any
branches: https://app.travis-ci.com/github/apache/tapestry-5/branches.
This way, you can be sure you won't break anything before merging to
master while still being able to have Git to store and version your
changes.

> Another option would be creating a proxy in case of an optional and missing
> component, which reacts with an appropriate Exception if used.
> Or do you think that's overkill?

I believe it is overkill. In addition, you can just check for null
instead of having to have a try/catch in order to know whether the
injected component exists or not.

Thank you for suggesting and implementing this! I really, really love
all the activity we're having on Tapestry's repository lately. :)

Also, I'd like to cut 5.8.3 soon to get CORS and everything else out
there. Thoughts?

Cheers!

-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org